Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
94980852
Commit
94980852
authored
Jun 15, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated emails, notifications and passwords controller
parent
968809dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
12 deletions
+16
-12
app/controllers/profiles/emails_controller.rb
app/controllers/profiles/emails_controller.rb
+1
-1
app/controllers/profiles/notifications_controller.rb
app/controllers/profiles/notifications_controller.rb
+3
-1
app/controllers/profiles/passwords_controller.rb
app/controllers/profiles/passwords_controller.rb
+12
-10
No files found.
app/controllers/profiles/emails_controller.rb
View file @
94980852
...
@@ -20,7 +20,7 @@ class Profiles::EmailsController < Profiles::ApplicationController
...
@@ -20,7 +20,7 @@ class Profiles::EmailsController < Profiles::ApplicationController
@email
=
current_user
.
emails
.
find
(
params
[
:id
])
@email
=
current_user
.
emails
.
find
(
params
[
:id
])
@email
.
destroy
@email
.
destroy
current_user
.
update_secondary_emails!
Users
::
UpdateService
.
new
(
current_user
,
current_user
).
execute
{
|
user
|
user
.
update_secondary_emails!
}
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
profile_emails_url
,
status:
302
}
format
.
html
{
redirect_to
profile_emails_url
,
status:
302
}
...
...
app/controllers/profiles/notifications_controller.rb
View file @
94980852
...
@@ -7,7 +7,9 @@ class Profiles::NotificationsController < Profiles::ApplicationController
...
@@ -7,7 +7,9 @@ class Profiles::NotificationsController < Profiles::ApplicationController
end
end
def
update
def
update
if
current_user
.
update_attributes
(
user_params
)
result
=
Users
::
UpdateService
.
new
(
current_user
,
current_user
,
user_params
).
execute
if
result
[
:status
]
==
:success
flash
[
:notice
]
=
"Notification settings saved"
flash
[
:notice
]
=
"Notification settings saved"
else
else
flash
[
:alert
]
=
"Failed to save new settings"
flash
[
:alert
]
=
"Failed to save new settings"
...
...
app/controllers/profiles/passwords_controller.rb
View file @
94980852
...
@@ -15,17 +15,17 @@ class Profiles::PasswordsController < Profiles::ApplicationController
...
@@ -15,17 +15,17 @@ class Profiles::PasswordsController < Profiles::ApplicationController
return
return
end
end
new_password
=
user_params
[
:password
]
password_attributes
=
{
new_password_confirmation
=
user_params
[
:password_confirmation
]
password:
user_params
[
:password
],
password_confirmation:
user_params
[
:password_confirmation
],
result
=
@user
.
update_attributes
(
password:
new_password
,
password_confirmation:
new_password_confirmation
,
password_automatically_set:
false
password_automatically_set:
false
)
}
result
=
Users
::
UpdateService
.
new
(
current_user
,
@user
,
password_attributes
).
execute
if
result
[
:status
]
==
:success
Users
::
UpdateService
.
new
(
current_user
,
@user
,
password_expires_at:
nil
).
execute
if
result
@user
.
update_attributes
(
password_expires_at:
nil
)
redirect_to
root_path
,
notice:
'Password successfully changed'
redirect_to
root_path
,
notice:
'Password successfully changed'
else
else
render
:new
render
:new
...
@@ -46,7 +46,9 @@ class Profiles::PasswordsController < Profiles::ApplicationController
...
@@ -46,7 +46,9 @@ class Profiles::PasswordsController < Profiles::ApplicationController
return
return
end
end
if
@user
.
update_attributes
(
password_attributes
)
result
=
Users
::
UpdateService
.
new
(
current_user
,
@user
,
password_attributes
).
execute
if
result
[
:status
]
==
:success
flash
[
:notice
]
=
"Password was successfully updated. Please login with it"
flash
[
:notice
]
=
"Password was successfully updated. Please login with it"
redirect_to
new_user_session_path
redirect_to
new_user_session_path
else
else
...
...
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