finish login i18n + controller

This commit is contained in:
wvengen 2013-02-05 12:54:55 +01:00
parent 419f5ef0ad
commit b12a906a74
6 changed files with 58 additions and 34 deletions

View file

@ -18,7 +18,7 @@ class LoginController < ApplicationController
logger.debug("Sent password reset email to #{user.email}.")
end
end
redirect_to login_url, :notice => "Wenn Deine E-Mail hier registiert ist bekommst Du jetzt eine Nachricht mit einem Passwort-Zurücksetzen-Link."
redirect_to login_url, :notice => I18n.t('login.reset_password.notice')
end
# Set a new password with a token from the password reminder email.
@ -34,7 +34,7 @@ class LoginController < ApplicationController
@user.reset_password_token = nil
@user.reset_password_expires = nil
@user.save
redirect_to login_url, :notice => "Dein Passwort wurde aktualisiert. Du kannst Dich jetzt anmelden."
redirect_to login_url, :notice => I18n.t('login.update_password.notice')
else
render :new_password
end
@ -44,10 +44,10 @@ class LoginController < ApplicationController
def accept_invitation
@invite = Invite.find_by_token(params[:token])
if (@invite.nil? || @invite.expires_at < Time.now)
flash[:error] = "Deine Einladung ist nicht (mehr) gültig."
flash[:error] = I18n.t('login.errors.invite_invalid')
render :action => 'login'
elsif @invite.group.nil?
flash[:error] = "Die Gruppe, in die Du eingeladen wurdest, existiert leider nicht mehr."
flash[:error] = I18n.t('login.errors.group_invalid')
render :action => 'login'
elsif (request.post?)
User.transaction do
@ -56,14 +56,14 @@ class LoginController < ApplicationController
if @user.save
Membership.new(:user => @user, :group => @invite.group).save!
@invite.destroy
redirect_to login_url, notice: "Herzlichen Glückwunsch, Dein Account wurde erstellt. Du kannst Dich nun einloggen."
redirect_to login_url, notice: I18n.t('login.accept_invitation.notice')
end
end
else
@user = User.new(:email => @invite.email)
end
rescue
flash[:error] = "Ein Fehler ist aufgetreten. Bitte erneut versuchen."
flash[:error] = I18n.t('errors.general_again')
end
protected
@ -71,7 +71,7 @@ class LoginController < ApplicationController
def validate_token
@user = User.find_by_id_and_reset_password_token(params[:id], params[:token])
if (@user.nil? || @user.reset_password_expires < Time.now)
flash.now.error = "Ungültiger oder abgelaufener Token. Bitte versuch es erneut."
flash[:error] = I18n.t('login.errors.token_invalid')
render :action => 'forgot_password'
end
end