Implement login form, and make some minor style changes
parent
b5bc476e08
commit
89dffba731
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
* ReDonate is more free software. It is licensed under the WTFPL, which
|
||||
* allows you to do pretty much anything with it, without having to
|
||||
* ask permission. Commercial use is allowed, and no attribution is
|
||||
* required. We do politely request that you share your modifications
|
||||
* to benefit other developers, but you are under no enforced
|
||||
* obligation to do so :)
|
||||
*
|
||||
* Please read the accompanying LICENSE document for the full WTFPL
|
||||
* licensing text.
|
||||
*/
|
||||
|
||||
if(!isset($_APP)) { die("Unauthorized."); }
|
||||
|
||||
$sError = "";
|
||||
|
||||
if(!empty($_POST['submit']))
|
||||
{
|
||||
if(empty($_POST['username']))
|
||||
{
|
||||
$sError = "You did not enter a username.";
|
||||
}
|
||||
elseif(empty($_POST['password']))
|
||||
{
|
||||
$sError = "You did not enter a password.";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$sUser = User::CreateFromQuery("SELECT * FROM users WHERE `Username` = :Username", array(":Username" => $_POST['username']), 0, true);
|
||||
|
||||
if($sUser->VerifyPassword($_POST['password']))
|
||||
{
|
||||
$sUser->Authenticate();
|
||||
redirect("/dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
$sError = "The password you entered is incorrect. Did you <a href=\"/forgot-password\">forget your password</a>?";
|
||||
}
|
||||
}
|
||||
catch (NotFoundException $e)
|
||||
{
|
||||
$sError = "That username does not exist.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sPageContents = NewTemplater::Render("login/form", $locale->strings, array('error' => $sError));
|
@ -0,0 +1,27 @@
|
||||
<div class="formwrapper narrow">
|
||||
<h2 class="spaced">Login to your account</h2>
|
||||
|
||||
{%if isempty|error == false}
|
||||
<div class="errors">
|
||||
{%?error}
|
||||
</div>
|
||||
{%/if}
|
||||
|
||||
<form method="post" action="/login" class="narrow">
|
||||
<div class="formfield">
|
||||
<label>Username</label>
|
||||
{%input type="text" name="username"}
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<div class="formfield">
|
||||
<label>Password</label>
|
||||
{%input type="password" name="password"}
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<div class="formfield submit">
|
||||
<button type="submit" name="submit" value="submit">Login</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -1,49 +1,51 @@
|
||||
<h2 class="spaced">Great! It'll only take a moment...</h2>
|
||||
<div class="formwrapper">
|
||||
<h2 class="spaced">Great! It'll only take a moment...</h2>
|
||||
|
||||
{%if isempty|errors == false}
|
||||
<div class="errors">
|
||||
One or more problems occurred:
|
||||
<ul>
|
||||
{%foreach error in errors}
|
||||
<li>{%?error}</li>
|
||||
{%/foreach}
|
||||
</ul>
|
||||
Please correct these issues and submit the form again.
|
||||
</div>
|
||||
{%/if}
|
||||
{%if isempty|errors == false}
|
||||
<div class="errors">
|
||||
One or more problems occurred:
|
||||
<ul>
|
||||
{%foreach error in errors}
|
||||
<li>{%?error}</li>
|
||||
{%/foreach}
|
||||
</ul>
|
||||
Please correct these issues and submit the form again.
|
||||
</div>
|
||||
{%/if}
|
||||
|
||||
<form method="post" action="/sign-up">
|
||||
<div class="formfield next-similar">
|
||||
<label>Username</label>
|
||||
{%input type="text" name="username"}
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<form method="post" action="/sign-up">
|
||||
<div class="formfield next-similar">
|
||||
<label>Username</label>
|
||||
{%input type="text" name="username"}
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<div class="formfield next-similar previous-similar">
|
||||
<label>Name (optional)</label>
|
||||
{%input type="text" name="displayname"}
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="formfield next-similar previous-similar">
|
||||
<label>Name (optional)</label>
|
||||
{%input type="text" name="displayname"}
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<div class="formfield previous-similar">
|
||||
<label>E-mail address</label>
|
||||
{%input type="email" name="email"}
|
||||
<div class="note">we'll send you a verification e-mail</div>
|
||||
</div>
|
||||
<div class="formfield previous-similar">
|
||||
<label>E-mail address</label>
|
||||
{%input type="email" name="email"}
|
||||
<div class="note">we'll send you a verification e-mail</div>
|
||||
</div>
|
||||
|
||||
<div class="formfield next-similar">
|
||||
<label>Password</label>
|
||||
{%input type="password" name="password"}
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="formfield next-similar">
|
||||
<label>Password</label>
|
||||
{%input type="password" name="password"}
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<div class="formfield previous-similar">
|
||||
<label>Password (again)</label>
|
||||
{%input type="password" name="password2"}
|
||||
<div class="note">at least 8 characters</div>
|
||||
</div>
|
||||
|
||||
<div class="formfield submit">
|
||||
<button type="submit" class="green-button" name="submit" value="submit">Sign me up!</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="formfield previous-similar">
|
||||
<label>Password (again)</label>
|
||||
{%input type="password" name="password2"}
|
||||
<div class="note">at least 8 characters</div>
|
||||
</div>
|
||||
|
||||
<div class="formfield submit">
|
||||
<button type="submit" class="green-button" name="submit" value="submit">Sign me up!</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue