X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/f864203056d2988b46b202f2cc00783378ee140a..791814d74ed95e758f848c38b63d41d3f1b30553:/app/controllers/user_controller.rb diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 659307460..2b695ce7a 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -28,6 +28,22 @@ class UserController < ApplicationController end end + def reset_password + if params['token'] + user = User.find_by_token(params['token']) + if user + pass = User.make_token(8) + user.pass_crypt = pass + user.save + Notifier::deliver_reset_password(user, pass) + flash[:notice] = "You're password has been changed and is on the way to your mailbox :-)" + else + flash[:notice] = "Didn't find that token, check the URL maybe?" + end + end + redirect_to :action => 'login' + end + def new end