Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
whb
9 years ago
Commit
55f0896e8a284728583c11129401f26e9681cbca
1 parent
53a9d5e7
邮箱找回密码
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
17 deletions
library/LibModels/Web/Passport/BackData.php
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Back.php
library/LibModels/Web/Passport/BackData.php
0 → 100644
View file @
55f0896
<?php
namespace
LibModels\Web\Passport
;
use
Api\Sign
;
use
Api\Yohobuy
;
class
BackData
extends
\LibModels\Wap\Passport\BackData
{
/**
* 验证找回邮件code
*
* @param string $code
* @return array
*/
public
static
function
checkEmailCode
(
$code
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.register.checkCodeValid'
;
$param
[
'code'
]
=
$code
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
,
3600
);
// 缓存1小时
}
/**
* 根据邮箱code修改密码
*
* @param string $code
* @param string $password
* @return array
*/
public
static
function
modifyPasswordByEmailCode
(
$code
,
$password
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.register.resetPwdByCode'
;
$param
[
'code'
]
=
$code
;
$param
[
'newPwd'
]
=
$password
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
}
}
\ No newline at end of file
...
...
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Back.php
View file @
55f0896
...
...
@@ -3,7 +3,7 @@ use Action\WebAction;
use
LibModels\Web\Passport\RegData
;
use
Passport\PassportModel
;
use
Plugin\Helpers
;
use
LibModels\W
ap
\Passport\BackData
;
use
LibModels\W
eb
\Passport\BackData
;
use
Plugin\AuthCode
;
class
BackController
extends
WebAction
{
...
...
@@ -43,14 +43,14 @@ class BackController extends WebAction {
if
(
Helpers
::
verifyEmail
(
$phoneNum
))
{
$ret
=
PassportModel
::
getUserInfoByEmail
(
$phoneNum
);
if
(
empty
(
$ret
))
{
$data
[
'message'
]
=
'该账户不存在'
;
$data
[
'code'
]
=
400
;
$data
[
'message'
]
=
'该邮件账户不存在'
;
$data
[
'code'
]
=
401
;
}
}
else
if
(
Helpers
::
verifyMobile
(
$phoneNum
))
{
$ret
=
PassportModel
::
getUserInfoByMobile
(
$area
,
$phoneNum
);
if
(
empty
(
$ret
))
{
$data
[
'message'
]
=
'该账户不存在'
;
$data
[
'code'
]
=
400
;
$data
[
'message'
]
=
'该手机号不存在'
;
$data
[
'code'
]
=
402
;
}
}
}
else
{
...
...
@@ -135,7 +135,22 @@ class BackController extends WebAction {
{
$code
=
$this
->
get
(
'code'
);
$info
=
$this
->
checkCode
(
$code
);
if
(
empty
(
$info
))
{
$verifyState
=
false
;
//验证状态
$ret
=
array
();
if
(
!
empty
(
$info
))
{
$verifyState
=
true
;
if
(
isset
(
$info
[
'uid'
]))
{
//老版修改邮箱密码
$verifyState
=
false
;
//重新找回密码
}
}
else
{
$ret
=
BackData
::
checkEmailCode
(
$code
);
if
(
isset
(
$ret
[
'data'
])
&&
$ret
[
'code'
]
==
200
)
{
$verifyState
=
true
;
}
}
//验证失败
if
(
!
$verifyState
)
{
$this
->
redirect
(
'index'
);
}
$banner
=
PassportModel
::
getLeftBanner
(
PassportModel
::
BACK_LFFT_BANNER_CODE
);
...
...
@@ -160,23 +175,29 @@ class BackController extends WebAction {
$code
=
$this
->
post
(
'code'
);
$password
=
$this
->
post
(
'pwd'
);
$info
=
$this
->
checkCode
(
$code
);
if
(
Helpers
::
verifyPassword
(
$password
)
&&
!
empty
(
$info
))
{
// 修改密码
if
(
isset
(
$info
[
'mobile'
]
))
{
// 手机号修改密码
$mobile
=
$info
[
'mobile'
];
$token
=
$info
[
'token'
];
$area
=
$info
[
'area'
];
$data
=
BackData
::
modifyPasswordByMobile
(
$mobile
,
$token
,
$password
,
$area
);
if
(
Helpers
::
verifyPassword
(
$password
))
{
if
(
!
empty
(
$info
))
{
//手机号找回
// 修改密码
if
(
isset
(
$info
[
'mobile'
]
))
{
// 手机号修改密码
$mobile
=
$info
[
'mobile'
];
$token
=
$info
[
'token'
];
$area
=
$info
[
'area'
];
$data
=
BackData
::
modifyPasswordByMobile
(
$mobile
,
$token
,
$password
,
$area
);
if
(
$data
[
'code'
]
==
200
)
{
$this
->
redirect
(
'resetSuccess'
);
}
}
else
if
(
isset
(
$info
[
'uid'
]))
{
//其他方式修改密码,跳到找回密码首页
$this
->
redirect
(
'/index'
);
}
}
else
{
//新版邮箱修改接口
$data
=
BackData
::
modifyPasswordByEmailCode
(
$code
,
$password
);
if
(
$data
[
'code'
]
==
200
)
{
$this
->
redirect
(
'resetSuccess'
);
}
}
else
if
(
isset
(
$info
[
'uid'
]))
{
// 其他方式修改密码
$uid
=
$info
[
'uid'
];
$this
->
redirect
(
'resetSuccess'
);
}
}
// 跳转错误页面
$this
->
redirect
(
'/
error/
index'
);
$this
->
redirect
(
'/index'
);
}
/**
...
...
Please
register
or
login
to post a comment