Sha256: d44c7ac06577e0b46b605db1fe1f7399318edb07f042486efac724d2b5309eeb

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 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"] 
        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] = "Password reset succesfully!"
        redirect_to log_in_path
      else
        flash[:error] = "Password could not be updated. Please try again later."
        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

1 entries across 1 versions & 1 rubygems

Version Path
user_mgmt-2.1.5 app/controllers/user_mgmt/registrations_controller.rb