Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
shishuangxi
2024-04-28 13:48:39 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3e7b4a1bb88f42ec18c29e8cdcd9099bfec6bbb7
3e7b4a1b
1 parent
aacd6a81
修复创造者账号无法登录问题
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
5 deletions
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
View file @
3e7b4a1
...
...
@@ -84,7 +84,11 @@ export class LoginModel {
// {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"}
appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) {
let bean: Record<string, string | number> = {};
bean['phone'] = phone
if (loginType == 0) {
bean['phone'] = phone
} else {
bean['userName'] = phone
}
bean['loginType'] = loginType
bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994'
bean['password'] = password
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
View file @
3e7b4a1
...
...
@@ -196,7 +196,6 @@ struct LoginPage {
Column() {
TextInput({ placeholder: "请输入账号", controller: this.phoneController })
.fontSize(16)
.maxLength(11)
.height(48)
.backgroundColor("#F5F5F5")
.borderRadius(4)
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
View file @
3e7b4a1
import { Logger } from 'wdKit/src/main/ets/utils/Logger'
import { LoginModel } from './LoginModel'
import { LoginBean } from './LoginBean'
import { SPHelper } from 'wdKit'
import { SPHelper
, StringUtils
} from 'wdKit'
import { CheckVerifyBean } from './CheckVerifyBean'
import cryptoFramework from '@ohos.security.cryptoFramework'
import buffer from '@ohos.buffer'
...
...
@@ -66,11 +66,17 @@ export class LoginViewModel {
}
async appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) {
let newLoginType: number
let isPhone = this.verifyIsPhoneNumber(phone)
if (isPhone) {
newLoginType = 0;
} else {
newLoginType = 8;
}
return new Promise<LoginBean>(async (success, fail) => {
let passwordNew = await this.doMd(password)
Logger.debug(TAG, "PASSWORD:" + passwordNew)
this.loginModel.appLoginByPassword(phone,
l
oginType, passwordNew, oldPassword).then((data: LoginBean) => {
this.loginModel.appLoginByPassword(phone,
newL
oginType, passwordNew, oldPassword).then((data: LoginBean) => {
SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark)
SPHelper.default.saveSync(SpConstants.USER_ID, data.id)
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken)
...
...
@@ -234,4 +240,18 @@ export class LoginViewModel {
})
})
}
public verifyIsPhoneNumber(phone: string): boolean {
const regex = /^1[3-9]\d{9}$/;
let isMatch: boolean;
if (StringUtils.isEmpty(phone)) {
return false;
} else if (phone.length != 11) {
return false;
} else {
isMatch = regex.test(phone)
}
return isMatch;
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment