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:
2015-04-29 07:51:02 +00:00
parent ee3f8867bf
commit f57c2971dc

View File

@@ -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,6 +77,8 @@ class auth
else else
$res .= $baseURL."authentication/$url"; $res .= $baseURL."authentication/$url";
$res .= "'>\n"; $res .= "'>\n";
if ($alreadyAuth === false)
{
$res .= " <h2 class='form-signin-heading'>".dgettext("domframework", $res .= " <h2 class='form-signin-heading'>".dgettext("domframework",
"Please sign in"); "Please sign in");
$res .= "</h2>\n"; $res .= "</h2>\n";
@@ -92,6 +94,15 @@ class auth
// $res .= "</label>\n"; // $res .= "</label>\n";
$res .= " <input type='submit' value='".dgettext("domframework", $res .= " <input type='submit' value='".dgettext("domframework",
"Sign in")."'/>\n"; "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";