summaryrefslogtreecommitdiff
path: root/app/controllers/my
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-05-21 22:32:45 -0600
committermo khan <mo@mokhan.ca>2014-05-21 22:32:45 -0600
commit0e1f35bf3f1a023e3f71b916ec5927ab46800249 (patch)
tree13deb602e0adff67bb4998f94eaa7c06f0cbfc78 /app/controllers/my
parent1ea8b4a3094aed558448edd93704f7964521a15a (diff)
move passwords to my/passwords.
Diffstat (limited to 'app/controllers/my')
-rw-r--r--app/controllers/my/passwords_controller.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/controllers/my/passwords_controller.rb b/app/controllers/my/passwords_controller.rb
new file mode 100644
index 00000000..7c0c8c0e
--- /dev/null
+++ b/app/controllers/my/passwords_controller.rb
@@ -0,0 +1,24 @@
+module My
+ class PasswordsController < BaseController
+ def index
+ @user = current_user
+ end
+
+ def update
+ ChangePassword.new(self).run(params[:user][:password], params[:user][:password_confirmation])
+ end
+
+ def password_changed(user)
+ @user = user
+ sign_in(@user, bypass: true) unless Rails.env.test?
+ flash[:notice] = t('passwords.updated')
+ render :index
+ end
+
+ def password_changed_failed(user)
+ @user = user
+ flash[:error] = t(:passwords_do_not_match)
+ render :index
+ end
+ end
+end