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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
c41e66db
Commit
c41e66db
authored
Oct 09, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate page for password change
parent
7af1bc3b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
1 deletion
+72
-1
app/controllers/profiles/passwords_controller.rb
app/controllers/profiles/passwords_controller.rb
+40
-1
app/views/profiles/passwords/edit.html.haml
app/views/profiles/passwords/edit.html.haml
+32
-0
No files found.
app/controllers/profiles/passwords_controller.rb
View file @
c41e66db
class
Profiles::PasswordsController
<
ApplicationController
class
Profiles::PasswordsController
<
ApplicationController
layout
'navless'
layout
:determine_layout
skip_before_filter
:check_password_expiration
skip_before_filter
:check_password_expiration
before_filter
:set_user
before_filter
:set_user
before_filter
:set_title
before_filter
:set_title
before_filter
:authorize_change_password!
def
new
def
new
end
end
...
@@ -26,6 +27,32 @@ class Profiles::PasswordsController < ApplicationController
...
@@ -26,6 +27,32 @@ class Profiles::PasswordsController < ApplicationController
end
end
end
end
def
edit
end
def
update
password_attributes
=
params
[
:user
].
select
do
|
key
,
value
|
%w(password password_confirmation)
.
include?
(
key
.
to_s
)
end
unless
@user
.
valid_password?
(
params
[
:user
][
:current_password
])
redirect_to
edit_profile_password_path
,
alert:
'You must provide a valid current password'
return
end
if
@user
.
update_attributes
(
password_attributes
)
flash
[
:notice
]
=
"Password was successfully updated. Please login with it"
redirect_to
new_user_session_path
else
render
'account'
end
end
def
reset
current_user
.
send_reset_password_instructions
redirect_to
edit_profile_password_path
,
notice:
'We sent you an email with reset password instructions'
end
private
private
def
set_user
def
set_user
...
@@ -35,4 +62,16 @@ class Profiles::PasswordsController < ApplicationController
...
@@ -35,4 +62,16 @@ class Profiles::PasswordsController < ApplicationController
def
set_title
def
set_title
@title
=
"New password"
@title
=
"New password"
end
end
def
determine_layout
if
[
:new
,
:create
].
include?
(
action_name
.
to_sym
)
'navless'
else
'profile'
end
end
def
authorize_change_password!
return
render_404
if
@user
.
ldap_user?
end
end
end
app/views/profiles/passwords/edit.html.haml
0 → 100644
View file @
c41e66db
%h3
.page-title
Password
%p
.light
Change your password or recover your current one.
%hr
.update-password
=
form_for
@user
,
url:
profile_password_path
,
method: :put
do
|
f
|
%div
%p
.slead
You must provide current password in order to change it.
%br
After a successful password update you will be redirected to login page where you should login with your new password
-
if
@user
.
errors
.
any?
.alert.alert-error
%ul
-
@user
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
.control-group
=
f
.
label
:current_password
.controls
=
f
.
password_field
:current_password
,
required:
true
%div
=
link_to
"Forgot your password?"
,
reset_profile_password_path
,
method: :put
.control-group
=
f
.
label
:password
,
'New password'
.controls
=
f
.
password_field
:password
,
required:
true
.control-group
=
f
.
label
:password_confirmation
.controls
=
f
.
password_field
:password_confirmation
,
required:
true
.form-actions
=
f
.
submit
'Save password'
,
class:
"btn btn-save"
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