Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
2395e2c9
Commit
2395e2c9
authored
Mar 22, 2017
by
Ujjwal Bhardwaj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solving bugs - setting email and logged out users
parent
843fdb65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
settings/Controller/UsersController.php
settings/Controller/UsersController.php
+17
-16
No files found.
settings/Controller/UsersController.php
View file @
2395e2c9
...
...
@@ -245,8 +245,7 @@ class UsersController extends Controller {
throw
new
\
Exception
(
$this
->
l10n
->
t
(
'Couldn\'t change the email address because the token is invalid'
));
}
if
(
$splittedToken
[
0
]
<
(
$this
->
timeFactory
->
getTime
()
-
60
*
60
*
12
)
||
$user
->
getLastLogin
()
>
$splittedToken
[
0
])
{
if
(
$splittedToken
[
0
]
<
(
$this
->
timeFactory
->
getTime
()
-
60
*
60
*
12
))
{
$this
->
config
->
deleteUserValue
(
$userId
,
'owncloud'
,
'changeMail'
);
throw
new
\
Exception
(
$this
->
l10n
->
t
(
'Couldn\'t change the email address because the token is invalid'
));
}
...
...
@@ -817,21 +816,23 @@ class UsersController extends Controller {
$this
->
setEmailAddress
(
$userId
,
$mailAddress
);
$tmpl
=
new
\
OC_Template
(
'settings'
,
'changemail/notify'
);
$tmpl
->
assign
(
'mailAddress'
,
$mailAddress
);
$msg
=
$tmpl
->
fetchPage
();
if
(
$oldEmailAddress
!==
null
)
{
$tmpl
=
new
\
OC_Template
(
'settings'
,
'changemail/notify'
);
$tmpl
->
assign
(
'mailAddress'
,
$mailAddress
);
$msg
=
$tmpl
->
fetchPage
();
try
{
$message
=
$this
->
mailer
->
createMessage
();
$message
->
setTo
([
$oldEmailAddress
=>
$userId
]);
$message
->
setSubject
(
$this
->
l10n
->
t
(
'%s email address changed successfully'
,
[
$this
->
defaults
->
getName
()]));
$message
->
setPlainBody
(
$msg
);
$message
->
setFrom
([
$this
->
fromMailAddress
=>
$this
->
defaults
->
getName
()]);
$this
->
mailer
->
send
(
$message
);
}
catch
(
\
Exception
$e
)
{
throw
new
\
Exception
(
$this
->
l10n
->
t
(
'Couldn\'t send email address change notification mail. Please contact your administrator.'
));
try
{
$message
=
$this
->
mailer
->
createMessage
();
$message
->
setTo
([
$oldEmailAddress
=>
$userId
]);
$message
->
setSubject
(
$this
->
l10n
->
t
(
'%s email address changed successfully'
,
[
$this
->
defaults
->
getName
()]));
$message
->
setPlainBody
(
$msg
);
$message
->
setFrom
([
$this
->
fromMailAddress
=>
$this
->
defaults
->
getName
()]);
$this
->
mailer
->
send
(
$message
);
}
catch
(
\
Exception
$e
)
{
throw
new
\
Exception
(
$this
->
l10n
->
t
(
'Couldn\'t send email address change notification mail. Please contact your administrator.'
));
}
}
return
new
RedirectResponse
(
$this
->
urlGenerator
->
linkToRoute
(
'settings.SettingsPage.getPersonal'
,
[
'changestatus'
=>
'success'
]));
}
...
...
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