Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-13 20:53:04 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-13 20:53:04 +0400
commit5b40780290e7d7c9e129e58c4f3f435073598ae6 (patch)
tree4208b073ab460e8f1bfab4fe98cf62d63a937be6 /app/controllers/passwords_controller.rb
parent81a9e81fae349e3e2b1cc336bf6cef767d65dbfc (diff)
Password expire: implement password resource inside profile. add before_fiter check
Diffstat (limited to 'app/controllers/passwords_controller.rb')
-rw-r--r--app/controllers/passwords_controller.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb
new file mode 100644
index 00000000000..166313130ad
--- /dev/null
+++ b/app/controllers/passwords_controller.rb
@@ -0,0 +1,35 @@
+class PasswordsController < ApplicationController
+ layout 'navless'
+
+ 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
+ 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