Login banned message

This commit is contained in:
斟酌 鵬兄 2016-03-11 22:17:02 +08:00
parent 0e7234c325
commit c83ca8e1a2
4 changed files with 32 additions and 6 deletions

View File

@ -6,7 +6,9 @@
font-family: monospace;
font-size: 1.12em;
color: black;
background-color: #EEE;
padding: 0.2em 0.5em;
}

View File

@ -39,6 +39,8 @@ input {
background: rgba(0, 0, 0, 0.1) !important;
}
.sttr { color: yellow; font-size: 0.8em; }
.cstatus {
position: relative;
}

View File

@ -1,6 +1,8 @@
(function(){
var ns = __namespace( "Astro.Blog.Layout.Login" );
/** @type {System.Cycle} */
var Cycle = __import( "System.Cycle" );
/** @type {System.utils.IKey} */
var IKey = __import( "System.utils.IKey" );
/** @type {Components.MessageBox} */
@ -19,6 +21,7 @@
var conf = config.get( "Login" );
var sHeat = conf.sHeat || "";
var sTTR = conf.sTTR || 0;
var formAction = conf.formAct || "./";
var field_username = new IKey( "name", "username" );
@ -27,24 +30,34 @@
var init = function ()
{
var username;
var form = Dand.wrapne('form'
var sTTRe;
var form = Dand.wrapne("form"
, [
// Basic login and password fields
, Dand.wrapc("flsf", "Name:")
, username = Dand.wrapna('input', [ field_username, new IKey("type", "text") ] )
, username = Dand.wrapna("input", [ field_username, new IKey("type", "text") ] )
, Dand.wrapc("flsf", "Password:")
, Dand.wrapna('input', [ field_password, new IKey("type", "password") ] )
, Dand.wrapna("input", [ field_password, new IKey("type", "password") ] )
, Dand.wrapc('msg', Dand.wrap('sub', null, sHeat.toLowerCase(), sHeat))
, sTTRe = Dand.wrap( "span", null, "sttr", PrintTTR( sTTR ) )
, Dand.wrapc( "msg", Dand.wrap("sub", null, sHeat.toLowerCase(), sHeat ) )
]
, [
// Form attributes
new IKey('action', formAction)
, new IKey('method', 'POST')
new IKey("action", formAction)
, new IKey("method", "POST")
]
);
if( 0 < sTTR )
{
Cycle.perma( "STTR", function()
{
if( 0 < sTTR -- ) sTTRe.innerHTML = PrintTTR( sTTR );
}, 1000 );
}
var mbox = new MessageBox( "Blog.Astro", form, "Login", false, submitForm.bind( form ) ).show();
username.focus();
@ -59,6 +72,13 @@
};
};
var PrintTTR = function ( s )
{
if( s <= 0 ) return "";
return "You are locked for " + s + "s, further login attempts will result in time-reset until the lock is released";
};
var submitForm = function (bool) {
if ( bool )
{

View File

@ -4,3 +4,5 @@ _AstConf_.Login = {};
_AstConf_.Login.formAct;
/** @type {String} */
_AstConf_.Login.sHeat;
/** @type {Number} */
_AstConf_.Login.sTTR;