diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-24 18:24:14 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-24 18:24:14 +0300 |
commit | 3e09e6f7b8032859a82266282dfd35715b3b3727 (patch) | |
tree | 7f882004565743b11cb4c734cbdfb9417fa1a9ab /app/controllers/profiles/passwords_controller.rb | |
parent | e55e23bbda6f6a95982109bc46e48a5550e4c181 (diff) | |
download | gitlab-ce-3e09e6f7b8032859a82266282dfd35715b3b3727.tar.gz |
Move Profile related controllers under Profiles:: module
Diffstat (limited to 'app/controllers/profiles/passwords_controller.rb')
-rw-r--r-- | app/controllers/profiles/passwords_controller.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb new file mode 100644 index 00000000000..432899f857d --- /dev/null +++ b/app/controllers/profiles/passwords_controller.rb @@ -0,0 +1,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 |