Sha256: 8d9c4c2a871ff6bcf79958ac4ba51b5a5ebe1a42384d4d81bc1af305f8312633

Contents?: true

Size: 1.29 KB

Versions: 13

Compression:

Stored size: 1.29 KB

Contents

require_dependency "user_mgmt/application_controller"

module UserMgmt
  class RegistrationsController < ApplicationController
    include ApplicationHelper
  	# GET /user/sign_up
    def new

    end

    # POST /user
    def create

      response = sign_up *params[:user].values
      
      if response[:status] == "200"
        flash[:success] = "User was created succesfully!"
        session[:user_session_id] = response[:body]["session"] 
        session.permanent[:user_session_id] = response[:body]["session"] 
        redirect_to main_app.root_path
      else 
        flash[:error] = response[:body]
        redirect_to sign_up_path      
      end

    end

    # GET /user/edit
    def edit

    end

    def add_strategy
    end

    def password_reset
    end

    def send_password_reset
      response = reset_password params[:user][:reset_token], params[:user][:new_pw], params[:user][:new_pw_confirm]
      if response[:status] == "200"
        flash[:success] = response[:body]
        redirect_to log_in_path
      else
        flash[:error] = response[:status]
        redirect_to password_reset_path
      end
    end

    def password_reset_request
    end

    def send_reset_request
      reset_password_request params[:user][:email]
      redirect_to password_reset_path
    end

  end  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
user_mgmt-2.0.0 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.1.1 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.1.0 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0.9 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0.8 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0.7 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0.6 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0.5 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0.4 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0.3 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0.2 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0.1 app/controllers/user_mgmt/registrations_controller.rb
user_mgmt-1.0 app/controllers/user_mgmt/registrations_controller.rb