auth : Add the application name in authentication panel

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2234 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-08-13 14:34:45 +00:00
parent ac0cf5a16b
commit e536e15009
2 changed files with 12 additions and 1 deletions

View File

@@ -6,6 +6,9 @@
/** User authentication (abstract class) */ /** User authentication (abstract class) */
class auth class auth
{ {
/** The application name */
public $appName = null;
/** Display the authentication page /** Display the authentication page
The message is displayed to the user in case of error The message is displayed to the user in case of error
The url is the caller url to go back if authentication is correct The url is the caller url to go back if authentication is correct
@@ -28,7 +31,7 @@ class auth
background-image: radial-gradient(ellipse at center -60px, background-image: radial-gradient(ellipse at center -60px,
#9da1ac 0%,#1c202a 100%); #9da1ac 0%,#1c202a 100%);
background-color: #eee; }\n"; background-color: #eee; }\n";
$res .= ".form-signin { max-width: 330px;padding:15px;margin:0 auto;}\n"; $res .= ".form-signin { max-width: 430px;padding:15px;margin:0 auto;}\n";
$res .= ".form-signin .form-signin-heading, .form-signin .checkbox {"; $res .= ".form-signin .form-signin-heading, .form-signin .checkbox {";
$res .= " margin-bottom: 10px; }\n"; $res .= " margin-bottom: 10px; }\n";
$res .= ".form-signin .checkbox { font-weight: normal; }\n"; $res .= ".form-signin .checkbox { font-weight: normal; }\n";
@@ -65,11 +68,14 @@ class auth
box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.2) inset, box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.2) inset,
0px 1px 2px rgba(0, 0, 0, 0.05); 0px 1px 2px rgba(0, 0, 0, 0.05);
background-color: #cccccc;}\n"; background-color: #cccccc;}\n";
$res .= "h1 { color: #bbb }\n";
$res .= "h2 { padding-top: 0px; padding-bottom: 30px;}\n"; $res .= "h2 { padding-top: 0px; padding-bottom: 30px;}\n";
$res .= " </style>\n"; $res .= " </style>\n";
$res .= " </head>\n"; $res .= " </head>\n";
$res .= " <body>\n"; $res .= " <body>\n";
$res .= "<div class='container'>\n"; $res .= "<div class='container'>\n";
if ($this->appName !== null)
$res .= "<h1>".$this->appName."</h1>\n";
$res .= " <form class='form-signin' role='form' method='post' "; $res .= " <form class='form-signin' role='form' method='post' ";
$res .= "action='"; $res .= "action='";
if ($url === "") if ($url === "")

View File

@@ -49,6 +49,9 @@ class authentication
);*/ );*/
public $authServers = array (); public $authServers = array ();
/** The application Name displayed on authentication page */
public $appName = null;
public function __construct ($route) public function __construct ($route)
{ {
$this->route = $route; $this->route = $route;
@@ -90,6 +93,8 @@ class authentication
$alreadyAuth = false; $alreadyAuth = false;
if ($pre->email !== "anonymous") if ($pre->email !== "anonymous")
$alreadyAuth = $pre->email; $alreadyAuth = $pre->email;
if ($this->appName !== null)
$auth->appName = $this->appName;
echo $auth->pageHTML ($this->route->baseURL(), $message, $url, echo $auth->pageHTML ($this->route->baseURL(), $message, $url,
$alreadyAuth); $alreadyAuth);
} }