@@ -17,15 +17,6 @@ class HackerRodauthPlugin < RodauthPlugin
1717 :login ,
1818 :remember ,
1919 :logout ,
20- :create_account ,
21- :verify_account ,
22- :verify_account_grace_period ,
23- :reset_password ,
24- :reset_password_notify ,
25- :change_login ,
26- :verify_login_change ,
27- :change_password ,
28- :change_password_notify ,
2920 :case_insensitive_login ,
3021 :internal_request
3122 )
@@ -47,9 +38,6 @@ class HackerRodauthPlugin < RodauthPlugin
4738 # Change prefix of table and foreign key column names from default "account"
4839 accounts_table :hackers
4940 remember_table :hacker_remember_keys
50- reset_password_table :hacker_password_reset_keys
51- verify_account_table :hacker_verification_keys
52- verify_login_change_table :hacker_login_change_keys
5341
5442 # The secret key used for hashing public-facing tokens for various features.
5543 # Defaults to Rails `secret_key_base`, but you can use your own secret key.
@@ -73,7 +61,6 @@ class HackerRodauthPlugin < RodauthPlugin
7361 # Change some default param keys.
7462 login_param "email"
7563 login_label "Email"
76- # password_confirm_param "confirm_password"
7764
7865 # Redirect back to originally requested location after authentication.
7966 login_return_to_requested_location? true
@@ -92,39 +79,6 @@ class HackerRodauthPlugin < RodauthPlugin
9279 # Requires the JSON feature
9380 # only_json? false
9481
95- # ==> Emails
96- # Use a custom mailer for delivering authentication emails.
97-
98- create_reset_password_email do
99- Rodauth ::HackerMailer . reset_password ( self . class . configuration_name ,
100- account_id , reset_password_key_value )
101- end
102-
103- create_verify_account_email do
104- Rodauth ::HackerMailer . verify_account ( self . class . configuration_name ,
105- account_id , verify_account_key_value )
106- end
107-
108- create_verify_login_change_email do |_login |
109- Rodauth ::HackerMailer . verify_login_change (
110- self . class . configuration_name ,
111- account_id ,
112- verify_login_change_key_value
113- )
114- end
115-
116- create_password_changed_email do
117- Rodauth ::HackerMailer . change_password_notify (
118- self . class . configuration_name , account_id
119- )
120- end
121-
122- create_reset_password_notify_email do
123- Rodauth ::HackerMailer . reset_password_notify (
124- self . class . configuration_name , account_id
125- )
126- end
127-
12882 send_email do |email |
12983 # queue email delivery on the mailer after the transaction commits
13084 db . after_commit { email . deliver_later }
@@ -152,7 +106,7 @@ class HackerRodauthPlugin < RodauthPlugin
152106 # ==> Passwords
153107
154108 # Passwords shorter than 8 characters are considered weak according to OWASP.
155- password_minimum_length 8
109+ # password_minimum_length 8
156110
157111 # Custom password complexity requirements (alternative to password_complexity feature).
158112 # password_meets_requirements? do |password|
@@ -182,6 +136,9 @@ class HackerRodauthPlugin < RodauthPlugin
182136 # Extend user's remember period when remembered via a cookie
183137 extend_remember_deadline? true
184138
139+ # Use separate session key for hacker authentication
140+ session_key "_hacker_session"
141+
185142 # Store the user's remember cookie under a namespace
186143 remember_cookie_key "_hacker_remember"
187144
@@ -211,24 +168,24 @@ class HackerRodauthPlugin < RodauthPlugin
211168 # Profile.find_by!(account_id: account_id).destroy
212169 # end
213170
214- create_account_route "register"
215-
216171 # ==> Redirects
217172
218- # Redirect to home after login.
219- create_account_redirect "/hacker_dashboard"
173+ # Ensure auto-login after omniauth account creation
174+ omniauth_create_account? true
175+
176+ # Redirect to dashboard after omniauth login/create (user is auto-logged in)
177+ after_omniauth_create_account do
178+ # Explicitly login if not already logged in
179+ login_session ( account_id ) unless logged_in?
180+ redirect "/hacker_dashboard"
181+ end
220182
221183 # Redirect to home after login.
222184 login_redirect "/hacker_dashboard"
223185
224186 # Redirect to home page after logout.
225- logout_redirect "/"
226-
227- # Redirect to wherever login redirects to after account verification.
228- verify_account_redirect { login_redirect }
187+ logout_redirect "/hacker_dashboard"
229188
230- # Redirect to login page after password reset.
231- reset_password_redirect { login_path }
232189 # ==> Deadlines
233190 # Change default deadlines for some actions.
234191 # verify_account_grace_period 3.days.to_i
0 commit comments