1
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
// Created by Mac on 2025/12/3.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "BaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface KBForgetPwdNewPwdVC : UIViewController
|
||||
@interface KBForgetPwdNewPwdVC : BaseViewController
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -7,7 +7,18 @@
|
||||
|
||||
#import "KBForgetPwdNewPwdVC.h"
|
||||
|
||||
@interface KBForgetPwdNewPwdVC ()
|
||||
@interface KBForgetPwdNewPwdVC () <UITextFieldDelegate>
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel; // Reset Password
|
||||
@property (nonatomic, strong) UIView *passwordFieldContainer;
|
||||
@property (nonatomic, strong) UITextField *passwordTextField;
|
||||
@property (nonatomic, strong) UIButton *passwordToggleButton;
|
||||
|
||||
@property (nonatomic, strong) UIView *repeatPasswordFieldContainer;
|
||||
@property (nonatomic, strong) UITextField *repeatPasswordTextField;
|
||||
@property (nonatomic, strong) UIButton *repeatPasswordToggleButton;
|
||||
|
||||
@property (nonatomic, strong) UIButton *nextButton; // Next Step
|
||||
|
||||
@end
|
||||
|
||||
@@ -15,17 +26,229 @@
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.kb_titleLabel.text = KBLocalized(@"Reset Password");
|
||||
|
||||
[self setupUI];
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
#pragma mark - UI
|
||||
|
||||
// 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.
|
||||
- (void)setupUI {
|
||||
[self.view addSubview:self.titleLabel];
|
||||
[self.view addSubview:self.passwordFieldContainer];
|
||||
[self.passwordFieldContainer addSubview:self.passwordTextField];
|
||||
[self.passwordFieldContainer addSubview:self.passwordToggleButton];
|
||||
[self.view addSubview:self.repeatPasswordFieldContainer];
|
||||
[self.repeatPasswordFieldContainer addSubview:self.repeatPasswordTextField];
|
||||
[self.repeatPasswordFieldContainer addSubview:self.repeatPasswordToggleButton];
|
||||
[self.view addSubview:self.nextButton];
|
||||
|
||||
// 标题
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT + 32);
|
||||
}];
|
||||
|
||||
// 新密码
|
||||
[self.passwordFieldContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(24);
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
make.height.mas_equalTo(52);
|
||||
}];
|
||||
|
||||
[self.passwordToggleButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.passwordFieldContainer);
|
||||
make.right.equalTo(self.passwordFieldContainer).offset(-16);
|
||||
make.width.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
[self.passwordTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.equalTo(self.passwordFieldContainer);
|
||||
make.left.equalTo(self.passwordFieldContainer).offset(16);
|
||||
make.right.equalTo(self.passwordToggleButton.mas_left).offset(-8);
|
||||
}];
|
||||
|
||||
// 确认密码
|
||||
[self.repeatPasswordFieldContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.passwordFieldContainer.mas_bottom).offset(16);
|
||||
make.left.right.height.equalTo(self.passwordFieldContainer);
|
||||
}];
|
||||
|
||||
[self.repeatPasswordToggleButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.repeatPasswordFieldContainer);
|
||||
make.right.equalTo(self.repeatPasswordFieldContainer).offset(-16);
|
||||
make.width.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
[self.repeatPasswordTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.equalTo(self.repeatPasswordFieldContainer);
|
||||
make.left.equalTo(self.repeatPasswordFieldContainer).offset(16);
|
||||
make.right.equalTo(self.repeatPasswordToggleButton.mas_left).offset(-8);
|
||||
}];
|
||||
|
||||
// Next Step 按钮
|
||||
[self.nextButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.repeatPasswordFieldContainer.mas_bottom).offset(24);
|
||||
make.left.right.equalTo(self.passwordFieldContainer);
|
||||
make.height.mas_equalTo(56);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (void)onTapTogglePassword:(UIButton *)sender {
|
||||
sender.selected = !sender.selected;
|
||||
BOOL show = sender.selected;
|
||||
if (sender == self.passwordToggleButton) {
|
||||
self.passwordTextField.secureTextEntry = !show;
|
||||
} else if (sender == self.repeatPasswordToggleButton) {
|
||||
self.repeatPasswordTextField.secureTextEntry = !show;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onTapNext {
|
||||
NSString *pwd = self.passwordTextField.text ?: @"";
|
||||
NSString *repeat = self.repeatPasswordTextField.text ?: @"";
|
||||
|
||||
if (pwd.length == 0 || repeat.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"Please complete all fields")];
|
||||
return;
|
||||
}
|
||||
if (![pwd isEqualToString:repeat]) {
|
||||
[KBHUD showInfo:KBLocalized(@"The two passwords do not match")];
|
||||
return;
|
||||
}
|
||||
|
||||
KBLOG(@"KBForgetPwdNewPwdVC next step, pwdLen=%zd", pwd.length);
|
||||
// TODO: 提交新密码逻辑
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
|
||||
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
||||
if (textField == self.passwordTextField) {
|
||||
[self.repeatPasswordTextField becomeFirstResponder];
|
||||
} else if (textField == self.repeatPasswordTextField) {
|
||||
[textField resignFirstResponder];
|
||||
[self onTapNext];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Lazy UI
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = KBLocalized(@"Reset Password");
|
||||
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_titleLabel.font = [KBFont bold:20];
|
||||
_titleLabel.textAlignment = NSTextAlignmentLeft;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIView *)passwordFieldContainer {
|
||||
if (!_passwordFieldContainer) {
|
||||
_passwordFieldContainer = [UIView new];
|
||||
_passwordFieldContainer.backgroundColor = [UIColor colorWithHex:0xF7F7F7];
|
||||
_passwordFieldContainer.layer.cornerRadius = 10.0;
|
||||
_passwordFieldContainer.layer.masksToBounds = YES;
|
||||
}
|
||||
return _passwordFieldContainer;
|
||||
}
|
||||
|
||||
- (UITextField *)passwordTextField {
|
||||
if (!_passwordTextField) {
|
||||
_passwordTextField = [[UITextField alloc] init];
|
||||
_passwordTextField.delegate = self;
|
||||
_passwordTextField.secureTextEntry = YES;
|
||||
_passwordTextField.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_passwordTextField.font = [KBFont regular:14];
|
||||
_passwordTextField.returnKeyType = UIReturnKeyNext;
|
||||
|
||||
NSString *ph = KBLocalized(@"Enter Password");
|
||||
_passwordTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:ph
|
||||
attributes:@{
|
||||
NSForegroundColorAttributeName : [UIColor colorWithWhite:0.75 alpha:1.0],
|
||||
NSFontAttributeName : [KBFont regular:14]
|
||||
}];
|
||||
}
|
||||
return _passwordTextField;
|
||||
}
|
||||
|
||||
- (UIButton *)passwordToggleButton {
|
||||
if (!_passwordToggleButton) {
|
||||
_passwordToggleButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
UIImage *eye = [UIImage imageNamed:@"login_eye_icon"];
|
||||
UIImage *eyeSlash = [UIImage imageNamed:@"login_eyeslash_icon"];
|
||||
[_passwordToggleButton setImage:eye forState:UIControlStateNormal];
|
||||
[_passwordToggleButton setImage:eyeSlash forState:UIControlStateSelected];
|
||||
[_passwordToggleButton addTarget:self
|
||||
action:@selector(onTapTogglePassword:)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _passwordToggleButton;
|
||||
}
|
||||
|
||||
- (UIView *)repeatPasswordFieldContainer {
|
||||
if (!_repeatPasswordFieldContainer) {
|
||||
_repeatPasswordFieldContainer = [UIView new];
|
||||
_repeatPasswordFieldContainer.backgroundColor = [UIColor colorWithHex:0xF7F7F7];
|
||||
_repeatPasswordFieldContainer.layer.cornerRadius = 10.0;
|
||||
_repeatPasswordFieldContainer.layer.masksToBounds = YES;
|
||||
}
|
||||
return _repeatPasswordFieldContainer;
|
||||
}
|
||||
|
||||
- (UITextField *)repeatPasswordTextField {
|
||||
if (!_repeatPasswordTextField) {
|
||||
_repeatPasswordTextField = [[UITextField alloc] init];
|
||||
_repeatPasswordTextField.delegate = self;
|
||||
_repeatPasswordTextField.secureTextEntry = YES;
|
||||
_repeatPasswordTextField.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_repeatPasswordTextField.font = [KBFont regular:14];
|
||||
_repeatPasswordTextField.returnKeyType = UIReturnKeyDone;
|
||||
|
||||
NSString *ph = KBLocalized(@"Enter Repeat Password");
|
||||
_repeatPasswordTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:ph
|
||||
attributes:@{
|
||||
NSForegroundColorAttributeName : [UIColor colorWithWhite:0.75 alpha:1.0],
|
||||
NSFontAttributeName : [KBFont regular:14]
|
||||
}];
|
||||
}
|
||||
return _repeatPasswordTextField;
|
||||
}
|
||||
|
||||
- (UIButton *)repeatPasswordToggleButton {
|
||||
if (!_repeatPasswordToggleButton) {
|
||||
_repeatPasswordToggleButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
UIImage *eye = [UIImage imageNamed:@"login_eye_icon"];
|
||||
UIImage *eyeSlash = [UIImage imageNamed:@"login_eyeslash_icon"];
|
||||
[_repeatPasswordToggleButton setImage:eye forState:UIControlStateNormal];
|
||||
[_repeatPasswordToggleButton setImage:eyeSlash forState:UIControlStateSelected];
|
||||
[_repeatPasswordToggleButton addTarget:self
|
||||
action:@selector(onTapTogglePassword:)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _repeatPasswordToggleButton;
|
||||
}
|
||||
|
||||
- (UIButton *)nextButton {
|
||||
if (!_nextButton) {
|
||||
_nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_nextButton setTitle:KBLocalized(@"Next Step") forState:UIControlStateNormal];
|
||||
[_nextButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_nextButton.titleLabel.font = [KBFont medium:16];
|
||||
_nextButton.backgroundColor = [UIColor colorWithHex:KBColorValue];
|
||||
_nextButton.layer.cornerRadius = 28.0;
|
||||
_nextButton.layer.masksToBounds = YES;
|
||||
[_nextButton addTarget:self action:@selector(onTapNext)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _nextButton;
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#import "KBForgetVerPwdVC.h"
|
||||
#import "CRBoxInputView.h"
|
||||
#import "KBForgetPwdNewPwdVC.h"
|
||||
|
||||
@interface KBForgetVerPwdVC ()
|
||||
|
||||
@@ -74,6 +75,13 @@
|
||||
}
|
||||
KBLOG(@"KBVerPwdVC next step with code=%@", code);
|
||||
// TODO: 接后续重置密码的下一步逻辑
|
||||
KBForgetPwdNewPwdVC *vc = [[KBForgetPwdNewPwdVC alloc] init];
|
||||
UINavigationController *nav = KB_CURRENT_NAV;
|
||||
if ([nav isKindOfClass:[BaseNavigationController class]]) {
|
||||
[(BaseNavigationController *)nav kb_pushViewControllerRemovingSameClass:vc animated:YES];
|
||||
} else {
|
||||
[nav pushViewController:vc animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Lazy UI
|
||||
@@ -122,6 +130,7 @@
|
||||
prop.cornerRadius = 8.0;
|
||||
prop.cellBgColorNormal = [UIColor colorWithHex:0xF7F7F7];
|
||||
prop.cellBgColorSelected = [UIColor colorWithHex:0xE0F5F2];
|
||||
prop.cellCursorColor = [UIColor colorWithHex:KBBlackValue];
|
||||
prop.cellFont = [KBFont bold:20];
|
||||
prop.cellTextColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_codeInputView.customCellProperty = prop;
|
||||
|
||||
16
keyBoard/Class/Login/VC/KBRegistVerEmailVC.h
Normal file
16
keyBoard/Class/Login/VC/KBRegistVerEmailVC.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// KBRegistVerEmailVC.h
|
||||
// keyBoard
|
||||
//
|
||||
// Created by Mac on 2025/12/3.
|
||||
// 注册验证邮箱
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface KBRegistVerEmailVC : UIViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
31
keyBoard/Class/Login/VC/KBRegistVerEmailVC.m
Normal file
31
keyBoard/Class/Login/VC/KBRegistVerEmailVC.m
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// KBRegistVerEmailVC.m
|
||||
// keyBoard
|
||||
//
|
||||
// Created by Mac on 2025/12/3.
|
||||
//
|
||||
|
||||
#import "KBRegistVerEmailVC.h"
|
||||
|
||||
@interface KBRegistVerEmailVC ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation KBRegistVerEmailVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
/*
|
||||
#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
|
||||
Reference in New Issue
Block a user