revise_auth 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/revise_auth/email_controller.rb +3 -3
- data/app/controllers/revise_auth/password_controller.rb +8 -1
- data/app/controllers/revise_auth/registrations_controller.rb +1 -1
- data/app/controllers/revise_auth_controller.rb +0 -6
- data/config/locales/en.yml +10 -0
- data/config/routes.rb +1 -0
- data/lib/revise_auth/version.rb +1 -1
- 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: 44700fedfef11f40ec472b5a3577f9660b04acdde4aa8606a2a2c5e3856c0c09
|
4
|
+
data.tar.gz: a76df3e4eeb13822e6b341c49ede1a24a1e78de920d10cf960f1e1e0f4ec360f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b61d98ca68462aaa3adf426c4697ea309487c86dd18ab025d97da78a6835103fce342c275e47500b012f653b8fa5b619085996247a2644a5466c19142d98d3b
|
7
|
+
data.tar.gz: 8113dba96e39b285e32007e872de8028e579326e04b8f068e1dcc6d60d0fbb49d3f1116c8469eb105f6b52f1523ceae4c0324b09f2474c83ef6c6818588f1a80
|
@@ -4,18 +4,18 @@ class ReviseAuth::EmailController < ReviseAuthController
|
|
4
4
|
# GET /profile/email?confirmation_token=abcdef
|
5
5
|
def show
|
6
6
|
if User.find_by(confirmation_token: params[:confirmation_token])&.confirm_email_change
|
7
|
-
flash[:notice] = "
|
7
|
+
flash[:notice] = I18n.t("revise_auth.email_confirmed")
|
8
8
|
user_signed_in?
|
9
9
|
redirect_to (user_signed_in? ? profile_path : root_path)
|
10
10
|
else
|
11
|
-
redirect_to root_path, alert: "
|
11
|
+
redirect_to root_path, alert: I18n.t("revise_auth.email_confirm_failed")
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def update
|
16
16
|
if current_user.update(email_params)
|
17
17
|
current_user.send_confirmation_instructions
|
18
|
-
flash[:notice] = "
|
18
|
+
flash[:notice] = I18n.t("revise_auth.confirmation_email_sent", email: current_user.unconfirmed_email)
|
19
19
|
end
|
20
20
|
|
21
21
|
redirect_to profile_path
|
@@ -3,7 +3,7 @@ class ReviseAuth::PasswordController < ReviseAuthController
|
|
3
3
|
|
4
4
|
def update
|
5
5
|
if current_user.update(password_params)
|
6
|
-
flash[:notice] = "
|
6
|
+
flash[:notice] = I18n.t("revise_auth.password_changed")
|
7
7
|
end
|
8
8
|
|
9
9
|
redirect_to profile_path
|
@@ -14,4 +14,11 @@ class ReviseAuth::PasswordController < ReviseAuthController
|
|
14
14
|
def password_params
|
15
15
|
params.require(:user).permit(:password, :password_confirmation)
|
16
16
|
end
|
17
|
+
|
18
|
+
def validate_current_password
|
19
|
+
unless current_user.authenticate(params[:current_password])
|
20
|
+
flash[:alert] = I18n.t("revise_auth.incorrect_password")
|
21
|
+
render "revise_auth/registrations/edit", status: :unprocessable_entity
|
22
|
+
end
|
23
|
+
end
|
17
24
|
end
|
@@ -20,7 +20,7 @@ class ReviseAuth::RegistrationsController < ReviseAuthController
|
|
20
20
|
|
21
21
|
def update
|
22
22
|
if current_user.update(profile_params)
|
23
|
-
redirect_to profile_path, notice: "
|
23
|
+
redirect_to profile_path, notice: I18n.t("revise_auth.account_updated")
|
24
24
|
else
|
25
25
|
render :edit, status: :unprocessable_entity
|
26
26
|
end
|
@@ -1,8 +1,2 @@
|
|
1
1
|
class ReviseAuthController < ApplicationController
|
2
|
-
def validate_current_password
|
3
|
-
unless current_user.authenticate(params[:current_password])
|
4
|
-
flash[:alert] = "Your current password is incorrect. Please try again."
|
5
|
-
render :edit, status: :unprocessable_entity
|
6
|
-
end
|
7
|
-
end
|
8
2
|
end
|
data/config/locales/en.yml
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
en:
|
2
2
|
revise_auth:
|
3
3
|
account_deleted: "Your account has been deleted."
|
4
|
+
account_updated: "Account updated successfully."
|
5
|
+
|
4
6
|
invalid_email_or_password: "Invalid email or password."
|
5
7
|
sign_up_or_login: "Sign up or log in to continue."
|
6
8
|
|
9
|
+
# Password changes
|
10
|
+
password_changed: "Your password has been changed successfully."
|
11
|
+
incorrect_password: "Your current password is incorrect. Please try again."
|
12
|
+
|
13
|
+
# Email confirmations
|
14
|
+
email_confirmed: "Your email address has been successfully confirmed."
|
15
|
+
email_confirm_failed: "Unable to confirm email address."
|
16
|
+
confirmation_email_sent: "A confirmation email has been sent to %{email}"
|
data/config/routes.rb
CHANGED
data/lib/revise_auth/version.rb
CHANGED