Class: ErpApp::LoginController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ErpApp::LoginController
- Defined in:
- app/controllers/erp_app/login_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/erp_app/login_controller.rb', line 5 def index if session[:app_container] if session[:app_container] == :desktop @app_container = '/erp_app/desktop/' else @app_container = '/erp_app/organizer/' end else if params[:application] == 'desktop' @app_container = '/erp_app/desktop/' else @app_container = '/erp_app/organizer/' end end end |
#reset_password ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/erp_app/login_controller.rb', line 21 def reset_password @token = params[:token].present? ? params[:token].strip : nil @user = User.load_from_reset_password_token(@token) if @user.blank? flash[:notice] = 'Invalid Reset Token' redirect_to action: :index end end |
#update_password ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/erp_app/login_controller.rb', line 31 def update_password @token = params[:token].strip @user = User.load_from_reset_password_token(@token) if @user.blank? render :update => {:id => "#{@uuid}_result", :view => :invalid_reset_token} else # the next line makes the password confirmation validation work @user.password_confirmation = params[:password_confirmation].strip # the next line clears the temporary token and updates the password if @user.change_password!(params[:password].strip) flash[:notice] = 'Password Reset Successfully' render json: {success: true} else render json: {success: false, message: @user.errors..join('<br/>')} end end end |