This commit is contained in:
2025-12-03 16:45:58 +08:00
parent d06e0499bc
commit c1c4c85bd2
5 changed files with 165 additions and 10 deletions

View File

@@ -41,6 +41,8 @@
"Reset Password" = "Reset Password"; "Reset Password" = "Reset Password";
"Next Step" = "Next Step"; "Next Step" = "Next Step";
"Enter Email Verification Code" = "Enter Email Verification Code"; "Enter Email Verification Code" = "Enter Email Verification Code";
"Verify Email" = "Verify Email";
"We have already sent it to the email address %@. Please enter the 6-digit verification code from the email to verify your mailbox." = "We have already sent it to the email address %@. Please enter the 6-digit verification code from the email to verify your mailbox.";
// Language switching prompt // Language switching prompt

View File

@@ -41,6 +41,8 @@
"Reset Password" = "重置密码"; "Reset Password" = "重置密码";
"Next Step" = "下一步"; "Next Step" = "下一步";
"Enter Email Verification Code" = "请输入邮箱验证码"; "Enter Email Verification Code" = "请输入邮箱验证码";
"Verify Email" = "验证邮箱";
"We have already sent it to the email address %@. Please enter the 6-digit verification code from the email to verify your mailbox." = "我们已将验证码发送至邮箱 %@,请在邮件中查看并输入 6 位验证码完成验证。";
// 语言切换提示 // 语言切换提示

View File

@@ -10,6 +10,7 @@
#import <AuthenticationServices/AuthenticationServices.h> #import <AuthenticationServices/AuthenticationServices.h>
#import "KBLoginVM.h" #import "KBLoginVM.h"
#import "AppDelegate.h" #import "AppDelegate.h"
#import "KBRegistVerEmailVC.h"
@interface KBEmailRegistVC () <UITextViewDelegate, UITextFieldDelegate> @interface KBEmailRegistVC () <UITextViewDelegate, UITextFieldDelegate>
@@ -262,6 +263,13 @@
KBLOG(@"onTapSubmit email=%@, password length=%zd", KBLOG(@"onTapSubmit email=%@, password length=%zd",
self.emailTextField.text, self.emailTextField.text,
self.passwordTextField.text.length); self.passwordTextField.text.length);
KBRegistVerEmailVC *vc = [[KBRegistVerEmailVC 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];
}
} }
- (void)onTapForgotPassword { - (void)onTapForgotPassword {

View File

@@ -5,11 +5,11 @@
// Created by Mac on 2025/12/3. // Created by Mac on 2025/12/3.
// 注册验证邮箱 // 注册验证邮箱
#import <UIKit/UIKit.h> #import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface KBRegistVerEmailVC : UIViewController @interface KBRegistVerEmailVC : BaseViewController
@end @end

View File

@@ -6,26 +6,169 @@
// //
#import "KBRegistVerEmailVC.h" #import "KBRegistVerEmailVC.h"
#import "CRBoxInputView.h"
@interface KBRegistVerEmailVC () @interface KBRegistVerEmailVC ()
@property (nonatomic, strong) UILabel *titleLabel; // Verify Email
@property (nonatomic, strong) UILabel *subTitleLabel; // Enter Email Verification Code
@property (nonatomic, strong) CRBoxInputView *codeInputView;
@property (nonatomic, strong) UILabel *descLabel; //
@property (nonatomic, strong) UIButton *confirmButton; // Confirm
@end @end
@implementation KBRegistVerEmailVC @implementation KBRegistVerEmailVC
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. self.view.backgroundColor = [UIColor whiteColor];
self.kb_titleLabel.text = KBLocalized(@"Verify Email");
[self setupUI];
} }
/* #pragma mark - UI
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation - (void)setupUI {
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { [self.view addSubview:self.titleLabel];
// Get the new view controller using [segue destinationViewController]. [self.view addSubview:self.subTitleLabel];
// Pass the selected object to the new view controller. [self.view addSubview:self.codeInputView];
[self.view addSubview:self.descLabel];
[self.view addSubview:self.confirmButton];
//
[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.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel);
make.top.equalTo(self.titleLabel.mas_bottom).offset(16);
}];
//
[self.codeInputView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.subTitleLabel.mas_bottom).offset(24);
make.left.equalTo(self.view).offset(24);
make.right.equalTo(self.view).offset(-24);
make.height.mas_equalTo(56);
}];
//
[self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.codeInputView.mas_bottom).offset(24);
make.left.equalTo(self.view).offset(24);
make.right.equalTo(self.view).offset(-24);
}];
// Confirm
[self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.descLabel.mas_bottom).offset(32);
make.left.equalTo(self.view).offset(24);
make.right.equalTo(self.view).offset(-24);
make.height.mas_equalTo(56);
}];
}
#pragma mark - Actions
- (void)onTapConfirm {
NSString *code = self.codeInputView.textValue ?: @"";
if (code.length == 0) {
[KBHUD showInfo:KBLocalized(@"Enter Email Verification Code")];
return;
}
KBLOG(@"KBRegistVerEmailVC confirm with code=%@", code);
// TODO:
}
#pragma mark - Lazy UI
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [UILabel new];
_titleLabel.text = KBLocalized(@"Verify Email");
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_titleLabel.font = [KBFont bold:20];
_titleLabel.textAlignment = NSTextAlignmentLeft;
}
return _titleLabel;
}
- (UILabel *)subTitleLabel {
if (!_subTitleLabel) {
_subTitleLabel = [UILabel new];
_subTitleLabel.text = KBLocalized(@"Enter Email Verification Code");
_subTitleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_subTitleLabel.font = [KBFont regular:14];
_subTitleLabel.textAlignment = NSTextAlignmentLeft;
}
return _subTitleLabel;
}
- (CRBoxInputView *)codeInputView {
if (!_codeInputView) {
_codeInputView = [[CRBoxInputView alloc] initWithCodeLength:6];
_codeInputView.backgroundColor = [UIColor clearColor];
_codeInputView.ifNeedCursor = YES;
_codeInputView.keyBoardType = UIKeyboardTypeNumberPad;
_codeInputView.inputType = CRInputType_Number;
// CRBoxFlowLayout *layout = [[CRBoxFlowLayout alloc] init];
// layout.itemSize = CGSizeMake(40, 48);
// layout.minimumInteritemSpacing = 12;
// layout.minimumLineSpacing = 12;
// layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
// _codeInputView.boxFlowLayout = layout;
CRBoxInputCellProperty *prop = [[CRBoxInputCellProperty alloc] init];
prop.borderWidth = 0;
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;
[_codeInputView loadAndPrepareView];
}
return _codeInputView;
}
- (UILabel *)descLabel {
if (!_descLabel) {
_descLabel = [UILabel new];
_descLabel.textColor = [UIColor colorWithHex:0x717171];
_descLabel.font = [KBFont regular:12];
_descLabel.numberOfLines = 0;
_descLabel.textAlignment = NSTextAlignmentLeft;
// %@
NSString *template = KBLocalized(@"We have already sent it to the email address %@. Please enter the 6-digit verification code from the email to verify your mailbox.");
//
NSString *email = @"example@mail.com";
_descLabel.text = [NSString stringWithFormat:template, email];
}
return _descLabel;
}
- (UIButton *)confirmButton {
if (!_confirmButton) {
_confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_confirmButton setTitle:KBLocalized(@"Confirm") forState:UIControlStateNormal];
[_confirmButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_confirmButton.titleLabel.font = [KBFont medium:16];
_confirmButton.backgroundColor = [UIColor colorWithHex:KBColorValue];
_confirmButton.layer.cornerRadius = 28.0;
_confirmButton.layer.masksToBounds = YES;
[_confirmButton addTarget:self action:@selector(onTapConfirm)
forControlEvents:UIControlEventTouchUpInside];
}
return _confirmButton;
} }
*/
@end @end