Merge pull request #9921 from nextcloud/resetpassword-login-prefill
prefill userid for login after password reset
This commit is contained in:
commit
45018a0e83
|
@ -206,10 +206,11 @@ class LostController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param array $data
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function success() {
|
private function success($data = []) {
|
||||||
return array('status'=>'success');
|
return array_merge($data, ['status'=>'success']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -282,7 +283,7 @@ class LostController extends Controller {
|
||||||
return $this->error($e->getMessage());
|
return $this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->success();
|
return $this->success(['user' => $userId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -162,7 +162,7 @@ OC.Lostpassword = {
|
||||||
resetDone : function(result){
|
resetDone : function(result){
|
||||||
var resetErrorMsg;
|
var resetErrorMsg;
|
||||||
if (result && result.status === 'success'){
|
if (result && result.status === 'success'){
|
||||||
OC.Lostpassword.redirect();
|
OC.Lostpassword.redirect('/login?user=' + result.user);
|
||||||
} else {
|
} else {
|
||||||
if (result && result.msg){
|
if (result && result.msg){
|
||||||
resetErrorMsg = result.msg;
|
resetErrorMsg = result.msg;
|
||||||
|
@ -175,12 +175,8 @@ OC.Lostpassword = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
redirect : function(msg){
|
redirect : function(url){
|
||||||
if(OC.webroot !== '') {
|
window.location = OC.generateUrl(url);
|
||||||
window.location = OC.webroot;
|
|
||||||
} else {
|
|
||||||
window.location = '/';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resetError : function(msg){
|
resetError : function(msg){
|
||||||
|
|
|
@ -571,7 +571,7 @@ class LostControllerTest extends \Test\TestCase {
|
||||||
)->willReturn('12345:TheOnlyAndOnlyOneTokenToResetThePassword');
|
)->willReturn('12345:TheOnlyAndOnlyOneTokenToResetThePassword');
|
||||||
|
|
||||||
$response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'ValidTokenUser', 'NewPassword', true);
|
$response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'ValidTokenUser', 'NewPassword', true);
|
||||||
$expectedResponse = array('status' => 'success');
|
$expectedResponse = array('user' => 'ValidTokenUser', 'status' => 'success');
|
||||||
$this->assertSame($expectedResponse, $response);
|
$this->assertSame($expectedResponse, $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue