admin session page i18n

This commit is contained in:
yafeilee 2015-04-08 00:57:19 +08:00
parent 1a773563d8
commit 5c5dca0d49
4 changed files with 32 additions and 10 deletions

View File

@ -6,13 +6,13 @@ class Admin::SessionsController < ApplicationController
def create def create
if ENV['ADMIN_USER'].blank? if ENV['ADMIN_USER'].blank?
render :json=> { success: false, message: '系统未配置管理员账户, 无法登录' } render :json=> { success: false, message: t('session.no_configuration') }
elsif ENV['ADMIN_USER'] != params[:username] elsif ENV['ADMIN_USER'] != params[:username]
render :json=> { success: false, message: '管理员账户错误' } render :json=> { success: false, message: t('session.username_error') }
elsif ENV['ADMIN_PASSWORD'] != params[:password] elsif ENV['ADMIN_PASSWORD'] != params[:password]
render :json=> { success: false, message: '管理员密码错误' } render :json=> { success: false, message: t('session.password_error') }
else else
flash[:notice] = '登录成功' flash[:notice] = t('session.login_success')
session[:login] = true session[:login] = true
render :json=> { success: true } render :json=> { success: true }
end end

View File

@ -1,16 +1,16 @@
.row ng-controller="AdminSessionsController" .row ng-controller="AdminSessionsController"
.small-12.large-8.columns .small-12.large-8.columns
h3.blog-title 登录后台 h3.blog-title #{t('session.title')}
form ng-submit="login()" form ng-submit="login()"
.row .row
.small-12.large-8.columns .small-12.large-8.columns
= label_tag 'username', '用户名' = label_tag 'username', t('session.username')
= text_field_tag 'username', nil, placeholder: '管理员账号', "ng-model"=>"username" = text_field_tag 'username', nil, placeholder: t('session.username_placeholder'), "ng-model"=>"username"
= label_tag 'username', '密码' = label_tag 'username', t('session.password')
= password_field_tag 'password', nil, placeholder: '管理员密码', "ng-model"=>"password" = password_field_tag 'password', nil, placeholder: t('session.password_placeholder'), "ng-model"=>"password"
p p
.alert-box.warning ng-show=" error_msg " .alert-box.warning ng-show=" error_msg "
|{{ error_msg }} |{{ error_msg }}
button 登录 button #{t('session.login_button')}

View File

@ -84,3 +84,14 @@ en:
comments_count: 'Comments Count' comments_count: 'Comments Count'
visited_count: 'Visited Count' visited_count: 'Visited Count'
subscribes_count: 'Subscribes Count' subscribes_count: 'Subscribes Count'
session:
title: 'Login dashboard'
username: 'Username'
username_placeholder: 'Admin username'
password: 'Password'
password_placeholder: 'Admin password'
login_button: 'Login now'
login_success: 'Login successfully'
no_configuration: 'There is no admin user, login failed'
username_error: 'Admin username error'
password_error: 'Admin password error'

View File

@ -84,3 +84,14 @@ zh-CN:
comments_count: '评论数' comments_count: '评论数'
visited_count: '浏览数' visited_count: '浏览数'
subscribes_count: '订阅数' subscribes_count: '订阅数'
session:
title: '登录后台'
username: '用户名'
username_placeholder: '管理员账号'
password: 'Password'
password_placeholder: '管理员密码'
login_button: '登录'
login_success: '登录成功'
no_configuration: '系统未配置管理员, 无法登录'
username_error: '用户名错误'
password_error: '密码错误'