blob: 432899f857df65ce817a382b4582f17f1ec617f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
class Profiles::PasswordsController < ApplicationController
layout 'navless'
skip_before_filter :check_password_expiration
before_filter :set_user
before_filter :set_title
def new
end
def create
new_password = params[:user][:password]
new_password_confirmation = params[:user][:password_confirmation]
result = @user.update_attributes(
password: new_password,
password_confirmation: new_password_confirmation
)
if result
@user.update_attributes(password_expires_at: nil)
redirect_to root_path, notice: 'Password successfully changed'
else
render :new
end
end
private
def set_user
@user = current_user
end
def set_title
@title = "New password"
end
end
|