feat: 更新登录模块以支持验证码和渐变背景

主要变更:
1. 在 EPLoginTypesViewController 中添加了渐变背景到 actionButton,提升视觉效果。
2. 实现了输入框状态检查功能,确保在输入有效信息时启用登录按钮。
3. 更新了输入框配置,支持不同类型的键盘输入(如数字键盘和邮箱键盘)。
4. 在 EPLoginService 中添加了对手机号和邮箱的 DES 加密,增强安全性。
5. 更新了 EPLoginConfig,统一输入框和按钮的样式设置。

此更新旨在提升用户体验,确保登录过程的安全性和流畅性。
This commit is contained in:
edwinQQQ
2025-10-13 17:49:09 +08:00
parent 809cc44ca5
commit 02a8335d70
8 changed files with 287 additions and 78 deletions

View File

@@ -83,13 +83,16 @@ import Foundation
completion: @escaping () -> Void,
failure: @escaping (Int, String) -> Void) {
// 🔐 DES
let encryptedEmail = encryptDES(email)
Api.emailGetCode({ (data, code, msg) in
if code == 200 {
completion()
} else {
failure(Int(code), msg ?? "发送邮箱验证码失败")
}
}, emailAddress: email, type: NSNumber(value: type))
}, emailAddress: encryptedEmail, type: NSNumber(value: type))
}
///
@@ -105,10 +108,16 @@ import Foundation
completion: @escaping () -> Void,
failure: @escaping (Int, String) -> Void) {
// Api+Login
// Api+Login.h
print("[EPLoginService] sendPhoneCode - 需要确认实际的 API 接口")
failure(-1, "手机验证码接口待确认")
// 🔐 DES
let encryptedPhone = encryptDES(phone)
Api.phoneSmsCode({ (data, code, msg) in
if code == 200 {
completion()
} else {
failure(Int(code), msg ?? "发送手机验证码失败")
}
}, mobile: encryptedPhone, type: String(type), phoneAreaCode: areaCode)
}
// MARK: - Login Methods
@@ -124,6 +133,10 @@ import Foundation
completion: @escaping (AccountModel) -> Void,
failure: @escaping (Int, String) -> Void) {
// 🔐 DES ID
let encryptedId = encryptDES(id)
let encryptedPassword = encryptDES(password)
Api.login(password: { [weak self] (data, code, msg) in
self?.parseAndSaveAccount(
data: data,
@@ -133,8 +146,8 @@ import Foundation
failure(errorCode, msg ?? "登录失败")
})
},
phone: id,
password: password,
phone: encryptedId,
password: encryptedPassword,
client_secret: clientSecret,
version: version,
client_id: clientId,
@@ -152,6 +165,9 @@ import Foundation
completion: @escaping (AccountModel) -> Void,
failure: @escaping (Int, String) -> Void) {
// 🔐 DES
let encryptedEmail = encryptDES(email)
Api.login(code: { [weak self] (data, code, msg) in
self?.parseAndSaveAccount(
data: data,
@@ -161,7 +177,7 @@ import Foundation
failure(errorCode, msg ?? "登录失败")
})
},
email: email,
email: encryptedEmail,
code: code,
client_secret: clientSecret,
version: version,
@@ -182,6 +198,9 @@ import Foundation
completion: @escaping (AccountModel) -> Void,
failure: @escaping (Int, String) -> Void) {
// 🔐 DES
let encryptedPhone = encryptDES(phone)
Api.login(code: { [weak self] (data, code, msg) in
self?.parseAndSaveAccount(
data: data,
@@ -191,7 +210,7 @@ import Foundation
failure(errorCode, msg ?? "登录失败")
})
},
phone: phone,
phone: encryptedPhone,
code: code,
client_secret: clientSecret,
version: version,
@@ -215,13 +234,17 @@ import Foundation
completion: @escaping () -> Void,
failure: @escaping (Int, String) -> Void) {
// 🔐 DES
let encryptedEmail = encryptDES(email)
let encryptedPassword = encryptDES(newPassword)
Api.resetPassword(email: { (data, code, msg) in
if code == 200 {
completion()
} else {
failure(Int(code), msg ?? "重置密码失败")
}
}, email: email, newPwd: newPassword, code: code)
}, email: encryptedEmail, newPwd: encryptedPassword, code: code)
}
///
@@ -239,13 +262,17 @@ import Foundation
completion: @escaping () -> Void,
failure: @escaping (Int, String) -> Void) {
// 🔐 DES
let encryptedPhone = encryptDES(phone)
let encryptedPassword = encryptDES(newPassword)
Api.resetPassword(phone: { (data, code, msg) in
if code == 200 {
completion()
} else {
failure(Int(code), msg ?? "重置密码失败")
}
}, phone: phone, newPwd: newPassword, smsCode: code, phoneAreaCode: areaCode)
}, phone: encryptedPhone, newPwd: encryptedPassword, smsCode: code, phoneAreaCode: areaCode)
}
// MARK: - Phone Quick Login ()