|
//
// modifyPwdController.m
// ThePaperHD
//
// Created by scar1900 on 15/3/27.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "modifyPwdController.h"
#define TEXTFIELDTAG 2000
@interface modifyPwdController (){
NSString *oriPwd;
NSString *newPwd;
}
@end
@implementation modifyPwdController
- (void)viewDidLoad {
[self.selectButton setHidden:YES];
[self.readRegisterContentBtn setHidden:YES];
[super viewDidLoad];
// Do any additional setup after loading the view.
self.titleLabel.text = @"修改密码";
self.confirmBtn.title = @"确 认";
NSAttributedString* atrString = [[NSAttributedString alloc] initWithString:@"原密码" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:LINECOLOR]}];
self.userNameField.attributedPlaceholder = atrString;
NSAttributedString* atrString1 = [[NSAttributedString alloc] initWithString:@"新密码" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:LINECOLOR]}];
self.passwordField.attributedPlaceholder = atrString1;
[self.userNameRangeLabel removeFromSuperview];
self.passwordRangeLabel.text = @"请输入6-12个数字或字母";
[self.selectButton removeFromSuperview];
[self.readRegisterContentBtn removeFromSuperview];
self.userNameField.secureTextEntry = YES;
}
- (void)addTextFieldImage {
UIImageView *userImageView = [[UIImageView alloc]initWithFrame:CGRectMake(15,
CGRectGetMinY(self.userNameField.frame)+2,
25,
55/2)];
userImageView.image = Image(@"login/password.png");
[self.keyboardView addSubview:userImageView];
UIImageView *passwordImageView = [[UIImageView alloc]initWithFrame:CGRectMake(15,
CGRectGetMinY(self.passwordField.frame)+2,
25,
55/2)];
passwordImageView.image = Image(@"login/password.png");
[self.keyboardView addSubview:passwordImageView];
}
#pragma mark - btn event
- (void)closeEvent:(UIButton*)btn {
[(MLNavigationController*)self.navigationController popViewControllerWithFlip];
}
- (void)textFieldDidChange:(UITextField *)textField {
if (textField.tag == TEXTFIELDTAG) {
oriPwd = textField.text;
}else if (textField.tag == TEXTFIELDTAG+1) {
newPwd = textField.text;
}
}
- (void)confirmEvent:(UIButton*)btn {
[self closeKeyBoard];
if (isBlankString(oriPwd)) {
ShowTextMessage(@"请输入原密码");
return;
}
if (isBlankString(newPwd)) {
ShowTextMessage(@"请输入新密码");
return;
}
NSDictionary *dic = @{@"pwd":newPwd,@"oldPwd":oriPwd};
[Remote doJsonActionWithBlock:0 requestUrl:modifyPwdURL parameter:dic withWaitCursor:YES completion:^(BOOL success, NSString *message, id responseData) {
if (success) {
if ([responseData[@"resultCode"] intValue] == 1) {
userBO *user = setJsonDicToDataModel(responseData[@"userInfo"], [userBO class]);
userBO *oriUser = [TPUserDefault instance].userBO;
user.loginType = oriUser.loginType;
[TPUserDefault instance].userBO = user;
[(MLNavigationController*)self.navigationController popViewControllerWithFlip];
}else {
ShowTextMessage(message);
}
}else {
ShowTextMessage(message);
}
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
|