Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
android
/
dayu
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b6358e44
authored
May 07, 2021
by
luofan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改密码去掉旧密码校验,忘记密码获取验证码增加滑块校验
parent
4778ebe4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
18 deletions
userCenter/src/main/java/com/dayu/usercenter/api/UserApiFactory.java
userCenter/src/main/java/com/dayu/usercenter/api/UserService.java
userCenter/src/main/java/com/dayu/usercenter/common/UserConstant.java
userCenter/src/main/java/com/dayu/usercenter/presenter/forgetpwd/ForgetPwdContract.java
userCenter/src/main/java/com/dayu/usercenter/presenter/forgetpwd/ForgetPwdPresenter.java
userCenter/src/main/java/com/dayu/usercenter/presenter/modifypwd/ModifyPwdPresenter.java
userCenter/src/main/java/com/dayu/usercenter/ui/activity/ForgetPwdActivity.java
userCenter/src/main/res/layout/activity_modify_pwd_layout.xml
userCenter/src/main/res/layout/forget_pwd_layout.xml
userCenter/src/main/java/com/dayu/usercenter/api/UserApiFactory.java
View file @
b6358e44
...
...
@@ -99,8 +99,8 @@ public class UserApiFactory {
return
Api
.
getDownloadService
(
UserService
.
class
).
verifyMegLive
(
body
).
compose
(
Api
.
applySchedulers
());
}
public
static
Observable
<
Boolean
>
sendForgetCode
(
String
telephone
,
int
type
)
{
return
Api
.
getDownloadService
(
UserService
.
class
).
sendForgetCode
(
telephone
,
type
).
compose
(
Api
.
applySchedulers
());
public
static
Observable
<
Boolean
>
sendForgetCode
(
String
telephone
,
int
type
,
RequestBody
body
)
{
return
Api
.
getDownloadService
(
UserService
.
class
).
sendForgetCode
(
telephone
,
type
,
body
).
compose
(
Api
.
applySchedulers
());
}
public
static
Observable
<
String
>
verifyCode
(
String
telephone
,
String
code
)
{
...
...
@@ -111,8 +111,8 @@ public class UserApiFactory {
return
Api
.
getDownloadService
(
UserService
.
class
).
forgetPwd
(
token
,
newpwd1
,
newpwd2
).
compose
(
Api
.
applySchedulers
());
}
public
static
Observable
<
String
>
modifyPwd
(
String
accountId
,
String
ordpwd
,
String
newpwd1
,
String
newpwd2
)
{
return
Api
.
getDownloadService
(
UserService
.
class
).
modifyPwd
(
accountId
,
ordpwd
,
newpwd1
,
newpwd2
).
compose
(
Api
.
applySchedulers
());
public
static
Observable
<
String
>
modifyPwd
(
String
accountId
,
String
newpwd1
,
String
newpwd2
)
{
return
Api
.
getDownloadService
(
UserService
.
class
).
modifyPwd
(
accountId
,
newpwd1
,
newpwd2
).
compose
(
Api
.
applySchedulers
());
}
public
static
Observable
<
Integer
>
getSiteId
(
int
accountId
)
{
...
...
userCenter/src/main/java/com/dayu/usercenter/api/UserService.java
View file @
b6358e44
...
...
@@ -210,8 +210,8 @@ public interface UserService {
* @param type
* @return
*/
@
GE
T
(
UserConstant
.
RESET_PWD_CODE
)
Observable
<
BaseResponse
<
Boolean
>>
sendForgetCode
(
@Path
(
"telephone"
)
String
telephone
,
@Path
(
"type"
)
int
type
);
@
POS
T
(
UserConstant
.
RESET_PWD_CODE
)
Observable
<
BaseResponse
<
Boolean
>>
sendForgetCode
(
@Path
(
"telephone"
)
String
telephone
,
@Path
(
"type"
)
int
type
,
@Body
RequestBody
body
);
/**
* 忘记密码校验验证码.
...
...
@@ -238,13 +238,12 @@ public interface UserService {
* 修改密码.
*
* @param accountId
* @param ordpwd
* @param newpwd1
* @param newpwd2
* @return
*/
@POST
(
UserConstant
.
MODIFY_PWD
)
Observable
<
BaseResponse
<
String
>>
modifyPwd
(
@Query
(
"accountId"
)
String
accountId
,
@Query
(
"
ordpwd"
)
String
ordpwd
,
@Query
(
"
newpwd1"
)
String
newpwd1
,
@Query
(
"newpwd2"
)
String
newpwd2
);
Observable
<
BaseResponse
<
String
>>
modifyPwd
(
@Query
(
"accountId"
)
String
accountId
,
@Query
(
"newpwd1"
)
String
newpwd1
,
@Query
(
"newpwd2"
)
String
newpwd2
);
/**
* 获取siteId.
...
...
userCenter/src/main/java/com/dayu/usercenter/common/UserConstant.java
View file @
b6358e44
...
...
@@ -109,7 +109,7 @@ public class UserConstant {
/**
* 修改密码.
*/
public
final
static
String
MODIFY_PWD
=
"/api-user/"
+
"account/modifyPwd"
;
public
final
static
String
MODIFY_PWD
=
"/api-user/"
+
"account/modifyPwd
/v2
"
;
/**
* 获取师傅siteid.
...
...
userCenter/src/main/java/com/dayu/usercenter/presenter/forgetpwd/ForgetPwdContract.java
View file @
b6358e44
...
...
@@ -16,6 +16,7 @@ public interface ForgetPwdContract {
*/
void
changeCodeBtn
();
void
showCaptchaDialog
();
}
abstract
class
Presenter
extends
BasePresenter
<
View
>
{
...
...
@@ -24,9 +25,10 @@ public interface ForgetPwdContract {
* 发送验证码.
*
*/
public
abstract
void
sendCode
();
public
abstract
void
sendCode
(
String
result
);
public
abstract
void
next
();
public
abstract
void
showCaptcha
();
}
}
userCenter/src/main/java/com/dayu/usercenter/presenter/forgetpwd/ForgetPwdPresenter.java
View file @
b6358e44
...
...
@@ -10,6 +10,13 @@ import com.dayu.usercenter.ui.activity.NewPwdActivity;
import
com.dayu.utils.ToastUtils
;
import
com.dayu.utils.UtilsUserAccountMatcher
;
import
org.json.JSONObject
;
import
java.util.HashMap
;
import
okhttp3.MediaType
;
import
okhttp3.RequestBody
;
/**
* Created by luofan
* on 2017/11/8.
...
...
@@ -27,14 +34,18 @@ public class ForgetPwdPresenter extends ForgetPwdContract.Presenter {
}
@Override
public
void
sendCode
()
{
public
void
sendCode
(
String
result
)
{
if
(!
UtilsUserAccountMatcher
.
isPhoneNum
(
phoneNume
.
get
()))
{
ToastUtils
.
showShortToast
(
R
.
string
.
alipay_phone_error
);
return
;
}
mView
.
showDialog
();
mView
.
changeCodeBtn
();
UserApiFactory
.
sendForgetCode
(
phoneNume
.
get
(),
1
).
subscribe
(
baseObserver
(
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"captchaVerification"
,
result
);
JSONObject
jsonObject
=
new
JSONObject
(
params
);
RequestBody
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
jsonObject
.
toString
());
UserApiFactory
.
sendForgetCode
(
phoneNume
.
get
(),
1
,
body
).
subscribe
(
baseObserver
(
aBoolean
->
mView
.
showToast
(
R
.
string
.
login_sms_success
)
,
throwable
->
mView
.
showToast
(
R
.
string
.
send_code_faile
)));
}
...
...
@@ -53,4 +64,9 @@ public class ForgetPwdPresenter extends ForgetPwdContract.Presenter {
mView
.
startActivityAndFinish
(
NewPwdActivity
.
class
,
bundle
);
}));
}
@Override
public
void
showCaptcha
()
{
mView
.
showCaptchaDialog
();
}
}
userCenter/src/main/java/com/dayu/usercenter/presenter/modifypwd/ModifyPwdPresenter.java
View file @
b6358e44
...
...
@@ -32,10 +32,10 @@ public class ModifyPwdPresenter extends ModifyPwdContract.Presenter {
@Override
public
void
ModifyPwd
()
{
if
(!
UtilsUserAccountMatcher
.
isPassword
(
oldCode
.
get
()))
{
ToastUtils
.
showShortToast
(
R
.
string
.
old_pwd_tip
);
return
;
}
//
if (!UtilsUserAccountMatcher.isPassword(oldCode.get())) {
//
ToastUtils.showShortToast(R.string.old_pwd_tip);
//
return;
//
}
if
(!
UtilsUserAccountMatcher
.
isPassword
(
newCode
.
get
()))
{
ToastUtils
.
showShortToast
(
R
.
string
.
new_pwd_tip
);
return
;
...
...
@@ -45,7 +45,7 @@ public class ModifyPwdPresenter extends ModifyPwdContract.Presenter {
return
;
}
mView
.
showDialog
();
UserApiFactory
.
modifyPwd
(
mAccountId
,
MD5Util
.
encrypt
(
oldCode
.
get
()),
MD5Util
.
encrypt
(
newCode
.
get
())
UserApiFactory
.
modifyPwd
(
mAccountId
,
MD5Util
.
encrypt
(
newCode
.
get
())
,
MD5Util
.
encrypt
(
againCode
.
get
()))
.
subscribe
(
baseObserver
(
s
->
mView
.
dumpToLogin
(
mPhone
)));
}
...
...
userCenter/src/main/java/com/dayu/usercenter/ui/activity/ForgetPwdActivity.java
View file @
b6358e44
...
...
@@ -11,6 +11,7 @@ import com.dayu.usercenter.presenter.forgetpwd.ForgetPwdContract;
import
com.dayu.usercenter.presenter.forgetpwd.ForgetPwdPresenter
;
import
com.dayu.utils.TimeCountUtil
;
import
com.dayu.utils.UIUtils
;
import
com.example.verificationcodejavademo.widget.BlockPuzzleDialog
;
import
com.umeng.analytics.MobclickAgent
;
/**
...
...
@@ -19,6 +20,8 @@ import com.umeng.analytics.MobclickAgent;
*/
public
class
ForgetPwdActivity
extends
BaseActivity
<
ForgetPwdPresenter
,
ForgetPwdLayoutBinding
>
implements
ForgetPwdContract
.
View
{
private
BlockPuzzleDialog
blockPuzzleDialog
;
@Override
public
int
getLayoutId
()
{
return
R
.
layout
.
forget_pwd_layout
;
...
...
@@ -49,6 +52,11 @@ public class ForgetPwdActivity extends BaseActivity<ForgetPwdPresenter, ForgetPw
});
mBind
.
getCode
.
setEnabled
(
false
);
mBind
.
next
.
setEnabled
(
false
);
blockPuzzleDialog
=
new
BlockPuzzleDialog
(
this
);
blockPuzzleDialog
.
setOnResultsListener
(
result
->
{
mPresenter
.
sendCode
(
result
);
});
}
public
void
isMatch
(
String
phone
,
String
code
)
{
...
...
@@ -70,8 +78,14 @@ public class ForgetPwdActivity extends BaseActivity<ForgetPwdPresenter, ForgetPw
MobclickAgent
.
onEvent
(
mActivity
,
"sms_code"
);
}
@Override
public
void
setPresenter
()
{
mBind
.
setPresenter
(
mPresenter
);
}
@Override
public
void
showCaptchaDialog
()
{
blockPuzzleDialog
.
show
();
}
}
userCenter/src/main/res/layout/activity_modify_pwd_layout.xml
View file @
b6358e44
...
...
@@ -64,6 +64,7 @@
android:layout_height=
"51dp"
android:layout_marginBottom=
"3dp"
android:background=
"@color/white"
android:visibility=
"gone"
android:orientation=
"horizontal"
android:paddingLeft=
"15dp"
android:paddingRight=
"15dp"
>
...
...
userCenter/src/main/res/layout/forget_pwd_layout.xml
View file @
b6358e44
...
...
@@ -103,7 +103,7 @@
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:alpha=
"0.35"
android:onClick=
"@{()->presenter.s
endCode
()}"
android:onClick=
"@{()->presenter.s
howCaptcha
()}"
android:text=
"@string/tv_login_register_button_text"
android:textColor=
"@color/bg_button"
/>
</LinearLayout>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment