Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
2b2b1b48
Commit
2b2b1b48
authored
11 years ago
by
Bernhard Posselt
Committed by
Morris Jobke
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
more style fixes
parent
a6e45a8d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/lostpassword/controller/lostcontroller.php
+24
-15
24 additions, 15 deletions
core/lostpassword/controller/lostcontroller.php
with
24 additions
and
15 deletions
core/lostpassword/controller/lostcontroller.php
+
24
−
15
View file @
2b2b1b48
...
...
@@ -71,6 +71,14 @@ class LostController extends Controller {
);
}
private
function
error
(
$message
,
array
$additional
=
array
())
{
return
array_combine
(
array
(
'status'
=>
'error'
,
'msg'
=>
$message
),
$additional
);
}
private
function
success
()
{
return
array
(
'status'
=>
'success'
);
}
/**
* @PublicPage
*
...
...
@@ -82,39 +90,36 @@ class LostController extends Controller {
try
{
$this
->
sendEmail
(
$user
,
$proceed
);
}
catch
(
EncryptedDataException
$e
){
array
(
'status'
=>
'
error'
,
'encryption'
=>
'1'
);
return
$this
->
error
(
'
'
,
array
(
'encryption'
=>
'1'
)
)
;
}
catch
(
\Exception
$e
){
return
array
(
'status'
=>
'error'
,
'msg'
=>
$e
->
getMessage
());
return
$this
->
error
(
$e
->
getMessage
());
}
return
array
(
'status'
=>
'
success
'
);
return
$this
->
success
(
);
}
/**
* @PublicPage
*/
public
function
setPassword
(
$token
,
$u
i
d
,
$password
)
{
public
function
setPassword
(
$token
,
$u
serI
d
,
$password
)
{
try
{
if
(
!
$this
->
checkToken
(
$uid
,
$token
))
{
throw
new
\Exception
();
}
$user
=
$this
->
userManager
->
get
(
$uid
);
if
(
!
$user
->
setPassword
(
$uid
,
$password
))
{
$user
=
$this
->
userManager
->
get
(
$userId
);
if
(
!
$this
->
checkToken
(
$userId
,
$token
)
||
!
$user
->
setPassword
(
$userId
,
$password
))
{
throw
new
\Exception
();
}
// FIXME: should be added to the all config at some point
\OC_Preferences
::
deleteKey
(
$u
i
d
,
'owncloud'
,
'lostpassword'
);
\OC_Preferences
::
deleteKey
(
$u
serI
d
,
'owncloud'
,
'lostpassword'
);
$this
->
userSession
->
unsetMagicInCookie
();
}
catch
(
\Exception
$e
){
return
array
(
'status'
=>
'error'
,
'msg'
=>
$e
->
getMessage
());
return
$this
->
error
(
$e
->
getMessage
());
}
return
array
(
'status'
=>
'
success
'
);
return
$this
->
success
(
);
}
...
...
@@ -153,6 +158,7 @@ class LostController extends Controller {
$msg
=
$tmpl
->
fetchPage
();
try
{
// FIXME: should be added to the container and injected in here
\OC_Mail
::
send
(
$email
,
$user
,
$this
->
l10n
->
t
(
'%s password reset'
,
array
(
...
...
@@ -162,8 +168,9 @@ class LostController extends Controller {
$this
->
defaults
->
getName
()
));
}
catch
(
\Exception
$e
)
{
throw
new
\Exception
(
$this
->
l10n
->
t
(
'Couldn’t send reset email. '
.
'Please contact your administrator.'
));
throw
new
\Exception
(
$this
->
l10n
->
t
(
'Couldn’t send reset email. Please contact your administrator.'
));
}
}
...
...
@@ -174,6 +181,7 @@ class LostController extends Controller {
'uid'
=>
$user
);
$link
=
$this
->
urlGenerator
->
linkToRoute
(
$route
,
$parameters
);
return
$this
->
urlGenerator
->
getAbsoluteUrl
(
$link
);
}
...
...
@@ -184,4 +192,5 @@ class LostController extends Controller {
)
===
hash
(
'sha256'
,
$token
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment