fix login i18n

This commit is contained in:
wvengen 2013-04-26 21:32:19 +02:00
parent 98b729eb71
commit 53d5eabf79
3 changed files with 27 additions and 26 deletions

View file

@ -22,7 +22,7 @@ class LoginController < ApplicationController
logger.debug("Sent password reset email to #{user.email}.") logger.debug("Sent password reset email to #{user.email}.")
end end
end end
redirect_to login_url, :notice => I18n.t('login.reset_password.notice') redirect_to login_url, :notice => I18n.t('login.controller.reset_password.notice')
end end
# Set a new password with a token from the password reminder email. # Set a new password with a token from the password reminder email.
@ -38,7 +38,7 @@ class LoginController < ApplicationController
@user.reset_password_token = nil @user.reset_password_token = nil
@user.reset_password_expires = nil @user.reset_password_expires = nil
@user.save @user.save
redirect_to login_url, :notice => I18n.t('login.update_password.notice') redirect_to login_url, :notice => I18n.t('login.controller.update_password.notice')
else else
render :new_password render :new_password
end end
@ -48,9 +48,9 @@ class LoginController < ApplicationController
def accept_invitation def accept_invitation
@invite = Invite.find_by_token(params[:token]) @invite = Invite.find_by_token(params[:token])
if @invite.nil? || @invite.expires_at < Time.now if @invite.nil? || @invite.expires_at < Time.now
redirect_to login_url, alert: I18n.t('login.errors.invite_invalid') redirect_to login_url, alert: I18n.t('login.controller.error_invite_invalid')
elsif @invite.group.nil? elsif @invite.group.nil?
redirect_to login_url, alert: I18n.t('login.errors.group_invalid') redirect_to login_url, alert: I18n.t('login.controller.error_group_invalid')
elsif request.post? elsif request.post?
User.transaction do User.transaction do
@user = User.new(params[:user]) @user = User.new(params[:user])
@ -58,7 +58,7 @@ class LoginController < ApplicationController
if @user.save if @user.save
Membership.new(:user => @user, :group => @invite.group).save! Membership.new(:user => @user, :group => @invite.group).save!
@invite.destroy @invite.destroy
redirect_to login_url, notice: I18n.t('login.accept_invitation.notice') redirect_to login_url, notice: I18n.t('login.controller.accept_invitation.notice')
end end
end end
else else
@ -71,7 +71,7 @@ class LoginController < ApplicationController
def validate_token def validate_token
@user = User.find_by_id_and_reset_password_token(params[:id], params[:token]) @user = User.find_by_id_and_reset_password_token(params[:id], params[:token])
if (@user.nil? || @user.reset_password_expires < Time.now) if (@user.nil? || @user.reset_password_expires < Time.now)
redirect_to forgot_password_url, alert: I18n.t('login.errors.token_invalid') redirect_to forgot_password_url, alert: I18n.t('login.controller.error_token_invalid')
end end
end end
end end

View file

@ -25,15 +25,15 @@ de:
submit: 'Neues passwort speichern' submit: 'Neues passwort speichern'
# used by controller # used by controller
controller:
reset_password: reset_password:
notice: 'Wenn Deine E-Mail hier registiert ist bekommst Du jetzt eine Nachricht mit einem Passwort-Zurücksetzen-Link.' notice: 'Wenn Deine E-Mail hier registiert ist bekommst Du jetzt eine Nachricht mit einem Passwort-Zurücksetzen-Link.'
update_password: update_password:
notice: 'Dein Passwort wurde aktualisiert. Du kannst Dich jetzt anmelden.' notice: 'Dein Passwort wurde aktualisiert. Du kannst Dich jetzt anmelden.'
accept_invitation: accept_invitation:
notice: 'Herzlichen Glückwunsch, Dein Account wurde erstellt. Du kannst Dich nun einloggen.' notice: 'Herzlichen Glückwunsch, Dein Account wurde erstellt. Du kannst Dich nun einloggen.'
errors: error_invite_invalid: 'Deine Einladung ist nicht (mehr) gültig.'
invite_invalid: 'Deine Einladung ist nicht (mehr) gültig.' error_group_invalid: 'Die Gruppe, in die Du eingeladen wurdest, existiert leider nicht mehr.'
group_invalid: 'Die Gruppe, in die Du eingeladen wurdest, existiert leider nicht mehr."' error_token_invalid: 'Ungültiger oder abgelaufener Token. Bitte versuch es erneut.'
token_invalid: 'Ungültiger oder abgelaufener Token. Bitte versuch es erneut.'

View file

@ -25,13 +25,14 @@ en:
submit: 'Save new password' submit: 'Save new password'
# used by controller # used by controller
controller:
reset_password: reset_password:
notice: 'If your email is registered here, you will receive a message with a link to reset your password.' notice: 'If your email is registered here, you will receive a message with a link to reset your password.'
update_password: update_password:
notice: 'Your password was updated. You can login now.' notice: 'Your password was updated. You can login now.'
accept_invitation: accept_invitation:
notice: 'Congratulations, your account was created. You can login now.' notice: 'Congratulations, your account was created. You can login now.'
errors: error_invite_invalid: 'Your invite is not valid (anymore).'
invite_invalid: 'Your invite is not valid (anymore).' error_group_invalid: 'The group in which you were invited doesnt exist anymore.'
group_invalid: 'The group in which you were invited doesnt exist anymore."' error_token_invalid: 'Invalid or expired token. Please try again.'
token_invalid: 'Invalid or expired token. Please try again.'