authentication-zero 2.3.5 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/authentication_zero/version.rb +1 -1
- data/lib/generators/authentication/templates/controllers/api/password_resets_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/api/registrations_controller.rb.tt +4 -4
- data/lib/generators/authentication/templates/controllers/api/sessions_controller.rb.tt +3 -3
- data/lib/generators/authentication/templates/controllers/html/password_resets_controller.rb.tt +2 -2
- data/lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt +3 -3
- data/lib/generators/authentication/templates/controllers/html/sessions_controller.rb.tt +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cd20da7b0f56b6c19dcc3133bd3423222705fd77b64b6754284b2d0a34b795d
|
4
|
+
data.tar.gz: a4fecf9bdff5dc659b584326323ac6b53840d4bc9e0e0096f957d68d34ce521b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b16ae0a95f453247ea61761bd50bac1abb196980ec8ec56cae879e58239b3f80ffcbb43cde1de81ac4bd50efecaaada6416890a9a04090c3c558c3ffa28870d
|
7
|
+
data.tar.gz: 4563fc71ef94b056bd823dca4dee733d0a337796b995d886e9eeca5cd82706deb43e108857dd70e1bedf1b29a67c0eb1dd08ef2f9fc231a1c0ef51f3c74f17e8
|
data/Gemfile.lock
CHANGED
data/lib/generators/authentication/templates/controllers/api/password_resets_controller.rb.tt
CHANGED
@@ -4,8 +4,8 @@ class PasswordResetsController < ApplicationController
|
|
4
4
|
before_action :set_<%= singular_table_name %>, only: :update
|
5
5
|
|
6
6
|
def create
|
7
|
-
if
|
8
|
-
IdentityMailer.with(<%= singular_table_name %>:
|
7
|
+
if @<%= singular_table_name %> = <%= class_name %>.find_by(email: params[:email], verified: true)
|
8
|
+
IdentityMailer.with(<%= singular_table_name %>: @<%= singular_table_name %>).password_reset_provision.deliver_later
|
9
9
|
else
|
10
10
|
render json: { error: "You can't reset your password until you verify your email" }, status: :not_found
|
11
11
|
end
|
@@ -2,12 +2,12 @@ class RegistrationsController < ApplicationController
|
|
2
2
|
skip_before_action :authenticate, only: :create
|
3
3
|
|
4
4
|
def create
|
5
|
-
|
5
|
+
@<%= singular_table_name %> = <%= class_name %>.new(<%= "#{singular_table_name}_params" %>)
|
6
6
|
|
7
|
-
if
|
8
|
-
render json:
|
7
|
+
if @<%= singular_table_name %>.save
|
8
|
+
render json: @<%= singular_table_name %>, status: :created
|
9
9
|
else
|
10
|
-
render json:
|
10
|
+
render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -15,10 +15,10 @@ class SessionsController < ApplicationController
|
|
15
15
|
<%= singular_table_name %> = <%= class_name %>.find_by_email(params[:email])
|
16
16
|
|
17
17
|
if <%= singular_table_name %> && <%= singular_table_name %>.authenticate(params[:password])
|
18
|
-
session = <%= singular_table_name %>.sessions.create!(session_params)
|
19
|
-
response.set_header("X-Session-Token", session.signed_id)
|
18
|
+
@session = <%= singular_table_name %>.sessions.create!(session_params)
|
19
|
+
response.set_header("X-Session-Token", @session.signed_id)
|
20
20
|
|
21
|
-
render json: session, status: :created
|
21
|
+
render json: @session, status: :created
|
22
22
|
else
|
23
23
|
render json: { error: "That email or password is incorrect" }, status: :unauthorized
|
24
24
|
end
|
data/lib/generators/authentication/templates/controllers/html/password_resets_controller.rb.tt
CHANGED
@@ -10,8 +10,8 @@ class PasswordResetsController < ApplicationController
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def create
|
13
|
-
if
|
14
|
-
IdentityMailer.with(<%= singular_table_name %>:
|
13
|
+
if @<%= singular_table_name %> = <%= class_name %>.find_by(email: params[:email], verified: true)
|
14
|
+
IdentityMailer.with(<%= singular_table_name %>: @<%= singular_table_name %>).password_reset_provision.deliver_later
|
15
15
|
redirect_to sign_in_path, notice: "Check your email for reset instructions"
|
16
16
|
else
|
17
17
|
redirect_to new_password_reset_path, alert: "You can't reset your password until you verify your email"
|
data/lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
CHANGED
@@ -6,10 +6,10 @@ class RegistrationsController < ApplicationController
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def create
|
9
|
-
|
9
|
+
@<%= singular_table_name %> = <%= class_name %>.new(<%= "#{singular_table_name}_params" %>)
|
10
10
|
|
11
|
-
if
|
12
|
-
session =
|
11
|
+
if @<%= singular_table_name %>.save
|
12
|
+
session = @<%= singular_table_name %>.sessions.create!(session_params)
|
13
13
|
cookies.signed.permanent[:session_token] = { value: session.id, httponly: true }
|
14
14
|
|
15
15
|
redirect_to root_path, notice: "Welcome! You have signed up successfully"
|
@@ -15,8 +15,8 @@ class SessionsController < ApplicationController
|
|
15
15
|
<%= singular_table_name %> = <%= class_name %>.find_by_email(params[:email])
|
16
16
|
|
17
17
|
if <%= singular_table_name %> && <%= singular_table_name %>.authenticate(params[:password])
|
18
|
-
session = <%= singular_table_name %>.sessions.create!(session_params)
|
19
|
-
cookies.signed.permanent[:session_token] = { value: session.id, httponly: true }
|
18
|
+
@session = <%= singular_table_name %>.sessions.create!(session_params)
|
19
|
+
cookies.signed.permanent[:session_token] = { value: @session.id, httponly: true }
|
20
20
|
|
21
21
|
redirect_to root_path, notice: "Signed in successfully"
|
22
22
|
else
|