mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 04:15:17 +00:00
Added mail caching system
This commit is contained in:
47
assets/js/components/mailCaching.js
Normal file
47
assets/js/components/mailCaching.js
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Mail caching controller
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.mailCaching = {
|
||||
|
||||
/**
|
||||
* @var Mail caching variable name
|
||||
*/
|
||||
__mailCachingVarName: "lastLoginMail",
|
||||
|
||||
/**
|
||||
* Get current cached value
|
||||
*
|
||||
* @return {String} The current stored mail / Empty string if it doesn't exist
|
||||
*/
|
||||
get: function(){
|
||||
//Try to get mail value
|
||||
var mail = localStorage.getItem(this.__mailCachingVarName);
|
||||
|
||||
//If not any mail was defined
|
||||
if(!mail)
|
||||
return ""; //Empty value
|
||||
|
||||
return mail;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set a new mail value
|
||||
*
|
||||
* @param {String} mail The mail address
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
set: function(mail){
|
||||
|
||||
//Check mail first
|
||||
if(!checkMail(mail))
|
||||
return false;
|
||||
|
||||
//Try to save mail
|
||||
localStorage.setItem(this.__mailCachingVarName, mail);
|
||||
return true;
|
||||
},
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
/**
|
||||
* Mail caching controller
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
@ -23,7 +23,9 @@ ComunicWeb.components.menuBar.notAuthenticated = {
|
||||
loginForm.setAttribute("role", "login");
|
||||
|
||||
loginForm.onsubmit = function(){
|
||||
//Try to login user; in case of failure redirect
|
||||
//Try to login user; in case of failure redirect to login page
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//Add email address formGroup
|
||||
|
Reference in New Issue
Block a user