Class: Lato::AuthenticationController
Instance Method Summary
collapse
#index, #switch_locale
#lato_index_collection
Methods included from Layoutable
#active_navbar, #active_sidebar, #hide_sidebar, #show_sidebar
#authenticate_session, #not_authenticate_session, #session_create, #session_destroy
Instance Method Details
#recover_password ⇒ Object
77
78
79
|
# File 'app/controllers/lato/authentication_controller.rb', line 77
def recover_password
@user = Lato::User.new
end
|
#recover_password_action ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'app/controllers/lato/authentication_controller.rb', line 81
def recover_password_action
@user = Lato::User.new
respond_to do |format|
if @user.request_recover_password(params.require(:user).permit(:email))
format.html { redirect_to lato.authentication_update_password_path(id: @user.id) }
format.json { render json: @user }
else
format.html { render :recover_password, status: :unprocessable_entity }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|
#signin ⇒ Object
10
11
12
|
# File 'app/controllers/lato/authentication_controller.rb', line 10
def signin
@user = Lato::User.new
end
|
#signin_action ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/lato/authentication_controller.rb', line 14
def signin_action
@user = Lato::User.new
respond_to do |format|
if @user.signin(params.require(:user).permit(:email, :password))
session_create(@user.id)
format.html { redirect_to lato.root_path }
format.json { render json: @user }
else
format.html { render :signin, status: :unprocessable_entity }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|
#signout ⇒ Object
50
|
# File 'app/controllers/lato/authentication_controller.rb', line 50
def signout; end
|
#signout_action ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'app/controllers/lato/authentication_controller.rb', line 52
def signout_action
session_destroy
respond_to do |format|
format.html { redirect_to lato.root_path }
format.json { render json: {} }
end
end
|
#signup ⇒ Object
30
31
32
|
# File 'app/controllers/lato/authentication_controller.rb', line 30
def signup
@user = Lato::User.new
end
|
#signup_action ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'app/controllers/lato/authentication_controller.rb', line 34
def signup_action
@user = Lato::User.new(params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :accepted_privacy_policy_version, :accepted_terms_and_conditions_version))
respond_to do |format|
if @user.save
session_create(@user.id)
format.html { redirect_to lato.root_path }
format.json { render json: @user }
else
format.html { render :signup, status: :unprocessable_entity }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|
#update_password ⇒ Object
95
|
# File 'app/controllers/lato/authentication_controller.rb', line 95
def update_password; end
|
#update_password_action ⇒ Object
97
98
99
100
101
102
103
104
105
106
107
|
# File 'app/controllers/lato/authentication_controller.rb', line 97
def update_password_action
respond_to do |format|
if @user.update_password(params.require(:user).permit(:code, :password, :password_confirmation))
format.html { redirect_to lato.authentication_signin_path, notice: I18n.t('lato.authentication_controller.update_password_action_notice') }
format.json { render json: @user }
else
format.html { render :update_password, status: :unprocessable_entity }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|
#verify_email ⇒ Object
61
62
63
|
# File 'app/controllers/lato/authentication_controller.rb', line 61
def verify_email
@code = params[:code]
end
|
#verify_email_action ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
|
# File 'app/controllers/lato/authentication_controller.rb', line 65
def verify_email_action
respond_to do |format|
if @user.verify_email(params.require(:user).permit(:code))
format.html { redirect_to lato.root_path, notice: I18n.t('lato.authentication_controller.verify_email_action_notice') }
format.json { render json: @user }
else
format.html { render :verify_email, status: :unprocessable_entity }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|