auth : if the user is already signed in, propose the logout link when arriving to the authentication page
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2087 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
43
auth.php
43
auth.php
@@ -11,7 +11,7 @@ class auth
|
|||||||
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
|
||||||
@param string|null $message Message to display to the user
|
@param string|null $message Message to display to the user
|
||||||
@param string|null $url URL to go back after successful authentication */
|
@param string|null $url URL to go back after successful authentication */
|
||||||
public function pageHTML ($baseURL, $message="", $url="")
|
public function pageHTML ($baseURL, $message="", $url="", $alreadyAuth=false)
|
||||||
{
|
{
|
||||||
$res = "";
|
$res = "";
|
||||||
$res .= "<!DOCTYPE html>\n";
|
$res .= "<!DOCTYPE html>\n";
|
||||||
@@ -77,21 +77,32 @@ class auth
|
|||||||
else
|
else
|
||||||
$res .= $baseURL."authentication/$url";
|
$res .= $baseURL."authentication/$url";
|
||||||
$res .= "'>\n";
|
$res .= "'>\n";
|
||||||
$res .= " <h2 class='form-signin-heading'>".dgettext("domframework",
|
if ($alreadyAuth === false)
|
||||||
"Please sign in");
|
{
|
||||||
$res .= "</h2>\n";
|
$res .= " <h2 class='form-signin-heading'>".dgettext("domframework",
|
||||||
$res .= " <input type='text' class='form-control' name='email' ";
|
"Please sign in");
|
||||||
$res .= "placeholder='".dgettext("domframework",
|
$res .= "</h2>\n";
|
||||||
"Email address")."' required autofocus/>\n";
|
$res .= " <input type='text' class='form-control' name='email' ";
|
||||||
$res .= " <input type='password' class='form-control' name='password' ";
|
$res .= "placeholder='".dgettext("domframework",
|
||||||
$res .= "placeholder='".dgettext("domframework",
|
"Email address")."' required autofocus/>\n";
|
||||||
"Password")."' required/>\n";
|
$res .= " <input type='password' class='form-control' name='password' ";
|
||||||
// $res .= " <label class='checkbox'>";
|
$res .= "placeholder='".dgettext("domframework",
|
||||||
// $res .= "<input type='checkbox' name='remember-me'/>".dgettext("domframework",
|
"Password")."' required/>\n";
|
||||||
// "Remember me");
|
// $res .= " <label class='checkbox'>";
|
||||||
// $res .= "</label>\n";
|
// $res .= "<input type='checkbox' name='remember-me'/>".dgettext("domframework",
|
||||||
$res .= " <input type='submit' value='".dgettext("domframework",
|
// "Remember me");
|
||||||
"Sign in")."'/>\n";
|
// $res .= "</label>\n";
|
||||||
|
$res .= " <input type='submit' value='".dgettext("domframework",
|
||||||
|
"Sign in")."'/>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$res .= " <h2 class='form-signin-heading'>".dgettext("domframework",
|
||||||
|
"Already sign in");
|
||||||
|
$res .= "</h2>\n";
|
||||||
|
$res .= " <p><a href='". $baseURL."authentication/logout'>".dgettext ("domframework", "Click here to logout")."</a></p>\n";
|
||||||
|
|
||||||
|
}
|
||||||
if ($message !== "")
|
if ($message !== "")
|
||||||
$res .= "<div class='alert alert-danger'>$message</div>";
|
$res .= "<div class='alert alert-danger'>$message</div>";
|
||||||
$res .= " </form>\n";
|
$res .= " </form>\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user