Skip to content

Commit a524b80

Browse files
committed
设置密码
1 parent 40d6c73 commit a524b80

19 files changed

Lines changed: 306 additions & 308 deletions

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
4E59E1D31A5E6B34004DAEEC /* TaskDescriptionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E59E1D21A5E6B34004DAEEC /* TaskDescriptionViewController.m */; };
7777
4E5C06E81AC2B34800F427C5 /* tipIcon_BranchMember@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E5C06E71AC2B34800F427C5 /* tipIcon_BranchMember@2x.png */; };
7878
4E5C06EB1AC4009100F427C5 /* CannotLoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C06EA1AC4009100F427C5 /* CannotLoginViewController.m */; };
79+
4E5C06EE1AC4405300F427C5 /* PasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C06ED1AC4405300F427C5 /* PasswordViewController.m */; };
7980
4E66EE261A28226000DA1B3E /* button_file_createFolder_enable@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E66EE211A28226000DA1B3E /* button_file_createFolder_enable@2x.png */; };
8081
4E66EE271A28226000DA1B3E /* button_file_denete_enable@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E66EE221A28226000DA1B3E /* button_file_denete_enable@2x.png */; };
8182
4E66EE281A28226000DA1B3E /* button_file_denete_unable@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E66EE231A28226000DA1B3E /* button_file_denete_unable@2x.png */; };
@@ -553,10 +554,6 @@
553554
8EF643AF19FF7E2900F7EEB0 /* TweetSendImageCCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6436219FF7E2900F7EEB0 /* TweetSendImageCCell.m */; };
554555
8EF643B019FF7E2900F7EEB0 /* CodingTipCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6436519FF7E2900F7EEB0 /* CodingTipCell.m */; };
555556
8EF643B119FF7E2900F7EEB0 /* ConversationCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6436719FF7E2900F7EEB0 /* ConversationCell.m */; };
556-
8EF643B219FF7E2900F7EEB0 /* Input_GlobalKey_Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6436919FF7E2900F7EEB0 /* Input_GlobalKey_Cell.m */; };
557-
8EF643B319FF7E2900F7EEB0 /* Input_GlobalKey_Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8EF6436A19FF7E2900F7EEB0 /* Input_GlobalKey_Cell.xib */; };
558-
8EF643B419FF7E2900F7EEB0 /* Input_LeftImgage_Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6436C19FF7E2900F7EEB0 /* Input_LeftImgage_Cell.m */; };
559-
8EF643B519FF7E2900F7EEB0 /* Input_LeftImgage_Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8EF6436D19FF7E2900F7EEB0 /* Input_LeftImgage_Cell.xib */; };
560557
8EF643B619FF7E2900F7EEB0 /* Input_OnlyText_Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6436F19FF7E2900F7EEB0 /* Input_OnlyText_Cell.m */; };
561558
8EF643B719FF7E2900F7EEB0 /* Input_OnlyText_Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8EF6437019FF7E2900F7EEB0 /* Input_OnlyText_Cell.xib */; };
562559
8EF643B819FF7E2900F7EEB0 /* InputOnlyTextPlainCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6437219FF7E2900F7EEB0 /* InputOnlyTextPlainCell.m */; };
@@ -698,6 +695,8 @@
698695
4E5C06E71AC2B34800F427C5 /* tipIcon_BranchMember@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tipIcon_BranchMember@2x.png"; sourceTree = "<group>"; };
699696
4E5C06E91AC4009100F427C5 /* CannotLoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CannotLoginViewController.h; sourceTree = "<group>"; };
700697
4E5C06EA1AC4009100F427C5 /* CannotLoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CannotLoginViewController.m; sourceTree = "<group>"; };
698+
4E5C06EC1AC4405300F427C5 /* PasswordViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PasswordViewController.h; sourceTree = "<group>"; };
699+
4E5C06ED1AC4405300F427C5 /* PasswordViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PasswordViewController.m; sourceTree = "<group>"; };
701700
4E66EE211A28226000DA1B3E /* button_file_createFolder_enable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button_file_createFolder_enable@2x.png"; sourceTree = "<group>"; };
702701
4E66EE221A28226000DA1B3E /* button_file_denete_enable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button_file_denete_enable@2x.png"; sourceTree = "<group>"; };
703702
4E66EE231A28226000DA1B3E /* button_file_denete_unable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button_file_denete_unable@2x.png"; sourceTree = "<group>"; };
@@ -1426,12 +1425,6 @@
14261425
8EF6436519FF7E2900F7EEB0 /* CodingTipCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CodingTipCell.m; sourceTree = "<group>"; };
14271426
8EF6436619FF7E2900F7EEB0 /* ConversationCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConversationCell.h; sourceTree = "<group>"; };
14281427
8EF6436719FF7E2900F7EEB0 /* ConversationCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConversationCell.m; sourceTree = "<group>"; };
1429-
8EF6436819FF7E2900F7EEB0 /* Input_GlobalKey_Cell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Input_GlobalKey_Cell.h; sourceTree = "<group>"; };
1430-
8EF6436919FF7E2900F7EEB0 /* Input_GlobalKey_Cell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Input_GlobalKey_Cell.m; sourceTree = "<group>"; };
1431-
8EF6436A19FF7E2900F7EEB0 /* Input_GlobalKey_Cell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Input_GlobalKey_Cell.xib; sourceTree = "<group>"; };
1432-
8EF6436B19FF7E2900F7EEB0 /* Input_LeftImgage_Cell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Input_LeftImgage_Cell.h; sourceTree = "<group>"; };
1433-
8EF6436C19FF7E2900F7EEB0 /* Input_LeftImgage_Cell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Input_LeftImgage_Cell.m; sourceTree = "<group>"; };
1434-
8EF6436D19FF7E2900F7EEB0 /* Input_LeftImgage_Cell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Input_LeftImgage_Cell.xib; sourceTree = "<group>"; };
14351428
8EF6436E19FF7E2900F7EEB0 /* Input_OnlyText_Cell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Input_OnlyText_Cell.h; sourceTree = "<group>"; };
14361429
8EF6436F19FF7E2900F7EEB0 /* Input_OnlyText_Cell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Input_OnlyText_Cell.m; sourceTree = "<group>"; };
14371430
8EF6437019FF7E2900F7EEB0 /* Input_OnlyText_Cell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Input_OnlyText_Cell.xib; sourceTree = "<group>"; };
@@ -2402,6 +2395,8 @@
24022395
8EA6CF2C19E240C40076D59C /* RegisterViewController.m */,
24032396
4E5C06E91AC4009100F427C5 /* CannotLoginViewController.h */,
24042397
4E5C06EA1AC4009100F427C5 /* CannotLoginViewController.m */,
2398+
4E5C06EC1AC4405300F427C5 /* PasswordViewController.h */,
2399+
4E5C06ED1AC4405300F427C5 /* PasswordViewController.m */,
24052400
);
24062401
path = Login;
24072402
sourceTree = "<group>";
@@ -2922,12 +2917,6 @@
29222917
8EF6436519FF7E2900F7EEB0 /* CodingTipCell.m */,
29232918
8EF6436619FF7E2900F7EEB0 /* ConversationCell.h */,
29242919
8EF6436719FF7E2900F7EEB0 /* ConversationCell.m */,
2925-
8EF6436819FF7E2900F7EEB0 /* Input_GlobalKey_Cell.h */,
2926-
8EF6436919FF7E2900F7EEB0 /* Input_GlobalKey_Cell.m */,
2927-
8EF6436A19FF7E2900F7EEB0 /* Input_GlobalKey_Cell.xib */,
2928-
8EF6436B19FF7E2900F7EEB0 /* Input_LeftImgage_Cell.h */,
2929-
8EF6436C19FF7E2900F7EEB0 /* Input_LeftImgage_Cell.m */,
2930-
8EF6436D19FF7E2900F7EEB0 /* Input_LeftImgage_Cell.xib */,
29312920
8EF6436E19FF7E2900F7EEB0 /* Input_OnlyText_Cell.h */,
29322921
8EF6436F19FF7E2900F7EEB0 /* Input_OnlyText_Cell.m */,
29332922
8EF6437019FF7E2900F7EEB0 /* Input_OnlyText_Cell.xib */,
@@ -3226,7 +3215,6 @@
32263215
4E9113AB1A1CB19900AC9431 /* icon_file_state_look@2x.png in Resources */,
32273216
8E97CEA31A0C7E26006F9AD7 /* coding_emoji_12@2x.png in Resources */,
32283217
4EBD0C661A1F2011004B4284 /* nav_project_file@2x.png in Resources */,
3229-
8EF643B519FF7E2900F7EEB0 /* Input_LeftImgage_Cell.xib in Resources */,
32303218
4E923E781A2F040D00427514 /* messageLeft_bg_img@2x.png in Resources */,
32313219
8EA6D17E19E240C40076D59C /* section_btn_close@2x.png in Resources */,
32323220
8E97CE9E1A0C7E26006F9AD7 /* coding_emoji_07@2x.png in Resources */,
@@ -3271,7 +3259,6 @@
32713259
4E996C051ABBF56A00C704F1 /* n_sex_man_icon@2x.png in Resources */,
32723260
8EA6D15919E240C40076D59C /* AppIcon120x120.png in Resources */,
32733261
8E97CEB71A0C7E26006F9AD7 /* coding_emoji_32@2x.png in Resources */,
3274-
8EF643B319FF7E2900F7EEB0 /* Input_GlobalKey_Cell.xib in Resources */,
32753262
8E97CEA71A0C7E26006F9AD7 /* coding_emoji_16@2x.png in Resources */,
32763263
4E1A22921AB19D1F00CFC14F /* git_icon_watched@2x.png in Resources */,
32773264
8E8F7B2C19EF6306006BA8BD /* btn_followed_both@2x.png in Resources */,
@@ -3516,7 +3503,6 @@
35163503
4E07D3111A4D1484009EDDF2 /* EaseStartView.m in Sources */,
35173504
8EA6D13819E240C40076D59C /* Message_RootViewController.m in Sources */,
35183505
0A782FD81AB5B69200E96661 /* TweetSendCreateLocationViewController.m in Sources */,
3519-
8EF643B219FF7E2900F7EEB0 /* Input_GlobalKey_Cell.m in Sources */,
35203506
8EA6D1BD19E240C40076D59C /* QcTask.m in Sources */,
35213507
4E35A99F1A3EC47E00CE35F1 /* FileViewController.m in Sources */,
35223508
0A6E6BAD1AB08540004C0107 /* TweetSendLocation.m in Sources */,
@@ -3644,6 +3630,7 @@
36443630
8EA6D12A19E240C40076D59C /* Coding_iOS.xcdatamodeld in Sources */,
36453631
8EA6D12D19E240C40076D59C /* ConversationViewController.m in Sources */,
36463632
4ECE8ADB1A3943E80021E29C /* NSDate+convenience.m in Sources */,
3633+
4E5C06EE1AC4405300F427C5 /* PasswordViewController.m in Sources */,
36473634
4E217F0E1A70EDC700F6DF88 /* SVWebViewController.m in Sources */,
36483635
4E6BA2DE1A1EE6AF005FD721 /* AFSecurityPolicy.m in Sources */,
36493636
4EA7F1631A6D192B00A046BD /* UIImage+MultiFormat.m in Sources */,
@@ -3693,7 +3680,6 @@
36933680
0A6E6BA71AAF4162004C0107 /* TweetSendLocationCell.m in Sources */,
36943681
4E8765651A22E5B40090CFB9 /* NSMutableArray+SWUtilityButtons.m in Sources */,
36953682
8ECA8BB419FB42CC00C598C6 /* UILongPressMenuImageView.m in Sources */,
3696-
8EF643B419FF7E2900F7EEB0 /* Input_LeftImgage_Cell.m in Sources */,
36973683
8EA6D1BE19E240C40076D59C /* Register.m in Sources */,
36983684
8EF643B019FF7E2900F7EEB0 /* CodingTipCell.m in Sources */,
36993685
8EA6D1BA19E240C40076D59C /* Projects.m in Sources */,

Coding_iOS/AppDelegate.m

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#import "XGPush.h"
2424
#import "EaseStartView.h"
2525
#import "BaseNavigationController.h"
26+
#import "PasswordViewController.h"
2627

2728
#import "Tweet.h"
2829

@@ -141,7 +142,9 @@ - (void)applicationWillEnterForeground:(UIApplication *)application
141142
- (void)applicationDidBecomeActive:(UIApplication *)application
142143
{
143144
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
144-
[[UnReadManager shareManager] updateUnRead];
145+
if ([Login isLogin]) {
146+
[[UnReadManager shareManager] updateUnRead];
147+
}
145148
}
146149

147150
- (void)applicationWillTerminate:(UIApplication *)application
@@ -211,13 +214,49 @@ - (void)customizeInterface {
211214

212215
#pragma mark URL Schemes
213216
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
214-
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
215-
for (NSString *param in [[url query] componentsSeparatedByString:@"&"]) {
216-
NSArray *elts = [param componentsSeparatedByString:@"="];
217-
if([elts count] < 2) continue;
218-
[params setObject:elts[1] forKey:elts[0]];
217+
NSLog(@"path: %@, params: %@", [url path], [url queryParams]);
218+
return [self showPasswordWithURL:url];
219+
}
220+
221+
- (BOOL)showPasswordWithURL:(NSURL *)url{
222+
PasswordType type;
223+
NSString *email, *key;
224+
225+
if ([[url lastPathComponent] isEqualToString:@"resetPassword"]) {
226+
type = PasswordReset;
227+
}else if ([[url lastPathComponent] isEqualToString:@"activate"]){
228+
type = PasswordActivate;
229+
}else{
230+
return NO;
219231
}
220-
NSLog(@"path: %@, params: %@", [url path], params);
232+
email = [[url queryParams] objectForKey:@"email"];
233+
key = [[url queryParams] objectForKey:@"key"];
234+
if (email.length <= 0 || key.length <= 0) {
235+
return NO;
236+
}
237+
238+
//弹出临时会话
239+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
240+
PasswordViewController *vc = [PasswordViewController passwordVCWithType:type email:[email URLDecoding] andKey:key];
241+
vc.successBlock = ^(PasswordViewController *presentVC, id data){
242+
[presentVC dismissViewControllerAnimated:YES completion:^{
243+
NSString *tipStr;
244+
switch (presentVC.type) {
245+
case PasswordReset:
246+
tipStr = @"修改密码成功~";
247+
break;
248+
case PasswordActivate:
249+
tipStr = @"账号激活成功~";
250+
break;
251+
default:
252+
tipStr = @"操作成功";
253+
break;
254+
}
255+
kTipAlert(@"%@", tipStr);
256+
}];
257+
};
258+
[BaseViewController presentVC:vc];
259+
});
221260
return YES;
222261
}
223262

Coding_iOS/Controllers/Login/CannotLoginViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#import "BaseViewController.h"
1010
typedef NS_ENUM(NSInteger, CannotLoginType) {
11-
CannotLoginTypePassword = 0,
11+
CannotLoginTypeResetPassword = 0,
1212
CannotLoginTypeActivate,
1313
};
1414

Coding_iOS/Controllers/Login/CannotLoginViewController.m

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ - (void)viewWillAppear:(BOOL)animated{
4646
}
4747
- (NSString *)titleStr{
4848
NSString *curStr = @"";
49-
if (_type == CannotLoginTypePassword) {
49+
if (_type == CannotLoginTypeResetPassword) {
5050
curStr = @"找回密码";
5151
}else if (_type == CannotLoginTypeActivate){
5252
curStr = @"重发激活邮件";
@@ -84,18 +84,15 @@ - (UIView *)customFooterView{
8484

8585
- (NSString *)footerBtnTitle{
8686
NSString *curStr = @"";
87-
if (_type == CannotLoginTypePassword) {
87+
if (_type == CannotLoginTypeResetPassword) {
8888
curStr = @"发送重置密码邮件";
8989
}else if (_type == CannotLoginTypeActivate){
9090
curStr = @"重发激活邮件";
9191
}
9292
return curStr;
9393
}
9494
#pragma mark - Table view data source
95-
96-
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
97-
{
98-
// Return the number of rows in the section.
95+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
9996
return 2;
10097
}
10198

@@ -137,17 +134,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
137134
#pragma mark Btn Clicked
138135
- (NSString *)requestPath{
139136
NSString *curStr = @"";
140-
if (_type == CannotLoginTypePassword) {
141-
curStr = @"api/resetPassword";
142-
}else if (_type == CannotLoginTypeActivate){
143-
curStr = @"api/activate";
144-
}
145-
return curStr;
146-
}
147-
148-
- (NSString *)sucessTipStr{
149-
NSString *curStr = @"";
150-
if (_type == CannotLoginTypePassword) {
137+
if (_type == CannotLoginTypeResetPassword) {
151138
curStr = @"api/resetPassword";
152139
}else if (_type == CannotLoginTypeActivate){
153140
curStr = @"api/activate";
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// PasswordViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/3/26.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
11+
typedef NS_ENUM(NSInteger, PasswordType) {
12+
PasswordReset = 0,
13+
PasswordActivate,
14+
};
15+
16+
@interface PasswordViewController : BaseViewController
17+
@property (nonatomic, assign) PasswordType type;
18+
@property (strong, nonatomic) NSString *email, *key, *password, *confirm_password;
19+
@property (nonatomic, copy) void(^successBlock)(PasswordViewController *vc, id data);
20+
+ (id)passwordVCWithType:(PasswordType)type email:(NSString *)email andKey:(NSString *)key;
21+
@end

0 commit comments

Comments
 (0)