admin session page i18n
This commit is contained in:
parent
1a773563d8
commit
5c5dca0d49
|
@ -6,13 +6,13 @@ class Admin::SessionsController < ApplicationController
|
|||
|
||||
def create
|
||||
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]
|
||||
render :json=> { success: false, message: '管理员账户错误' }
|
||||
render :json=> { success: false, message: t('session.username_error') }
|
||||
elsif ENV['ADMIN_PASSWORD'] != params[:password]
|
||||
render :json=> { success: false, message: '管理员密码错误' }
|
||||
render :json=> { success: false, message: t('session.password_error') }
|
||||
else
|
||||
flash[:notice] = '登录成功'
|
||||
flash[:notice] = t('session.login_success')
|
||||
session[:login] = true
|
||||
render :json=> { success: true }
|
||||
end
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
.row ng-controller="AdminSessionsController"
|
||||
.small-12.large-8.columns
|
||||
h3.blog-title 登录后台
|
||||
h3.blog-title #{t('session.title')}
|
||||
form ng-submit="login()"
|
||||
.row
|
||||
.small-12.large-8.columns
|
||||
= label_tag 'username', '用户名'
|
||||
= text_field_tag 'username', nil, placeholder: '管理员账号', "ng-model"=>"username"
|
||||
= label_tag 'username', '密码'
|
||||
= password_field_tag 'password', nil, placeholder: '管理员密码', "ng-model"=>"password"
|
||||
= label_tag 'username', t('session.username')
|
||||
= text_field_tag 'username', nil, placeholder: t('session.username_placeholder'), "ng-model"=>"username"
|
||||
= label_tag 'username', t('session.password')
|
||||
= password_field_tag 'password', nil, placeholder: t('session.password_placeholder'), "ng-model"=>"password"
|
||||
|
||||
p
|
||||
.alert-box.warning ng-show=" error_msg "
|
||||
|{{ error_msg }}
|
||||
|
||||
button 登录
|
||||
button #{t('session.login_button')}
|
||||
|
|
|
@ -84,3 +84,14 @@ en:
|
|||
comments_count: 'Comments Count'
|
||||
visited_count: 'Visited 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'
|
||||
|
|
|
@ -84,3 +84,14 @@ zh-CN:
|
|||
comments_count: '评论数'
|
||||
visited_count: '浏览数'
|
||||
subscribes_count: '订阅数'
|
||||
session:
|
||||
title: '登录后台'
|
||||
username: '用户名'
|
||||
username_placeholder: '管理员账号'
|
||||
password: 'Password'
|
||||
password_placeholder: '管理员密码'
|
||||
login_button: '登录'
|
||||
login_success: '登录成功'
|
||||
no_configuration: '系统未配置管理员, 无法登录'
|
||||
username_error: '用户名错误'
|
||||
password_error: '密码错误'
|
||||
|
|
Loading…
Reference in New Issue