prefill userid for login after password reset

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2018-06-19 17:02:20 +02:00
parent a10690c1e9
commit 8ed50d4b63
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
3 changed files with 8 additions and 11 deletions

View File

@ -206,10 +206,11 @@ class LostController extends Controller {
}
/**
* @param array $data
* @return array
*/
private function success() {
return array('status'=>'success');
private function success($data = []) {
return array_merge($data, ['status'=>'success']);
}
/**
@ -282,7 +283,7 @@ class LostController extends Controller {
return $this->error($e->getMessage());
}
return $this->success();
return $this->success(['user' => $userId]);
}
/**

View File

@ -162,7 +162,7 @@ OC.Lostpassword = {
resetDone : function(result){
var resetErrorMsg;
if (result && result.status === 'success'){
OC.Lostpassword.redirect();
OC.Lostpassword.redirect('/login?user=' + result.user);
} else {
if (result && result.msg){
resetErrorMsg = result.msg;
@ -175,12 +175,8 @@ OC.Lostpassword = {
}
},
redirect : function(msg){
if(OC.webroot !== '') {
window.location = OC.webroot;
} else {
window.location = '/';
}
redirect : function(url){
window.location = OC.generateUrl(url);
},
resetError : function(msg){

View File

@ -571,7 +571,7 @@ class LostControllerTest extends \Test\TestCase {
)->willReturn('12345:TheOnlyAndOnlyOneTokenToResetThePassword');
$response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'ValidTokenUser', 'NewPassword', true);
$expectedResponse = array('status' => 'success');
$expectedResponse = array('user' => 'ValidTokenUser', 'status' => 'success');
$this->assertSame($expectedResponse, $response);
}