dupe email check and notifications table

This commit is contained in:
realaravinth 2021-07-13 21:23:08 +05:30
parent 47cca5c9a7
commit 558dbef712
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
5 changed files with 51 additions and 34 deletions

View file

@ -182,7 +182,7 @@ pub mod runners {
if msg.contains("mcaptcha_users_name_key") {
return Err(ServiceError::UsernameTaken);
} else if msg.contains("mcaptcha_users_email_key") {
return Err(ServiceError::UsernameTaken);
return Err(ServiceError::EmailTaken);
} else if msg.contains("mcaptcha_users_secret_key") {
continue;
} else {

View file

@ -59,7 +59,7 @@ async fn auth_works() {
signin(EMAIL, PASSWORD).await;
// 2. check if duplicate username is allowed
let msg = Register {
let mut msg = Register {
username: NAME.into(),
password: PASSWORD.into(),
confirm_password: PASSWORD.into(),
@ -75,6 +75,18 @@ async fn auth_works() {
)
.await;
let name = format!("{}dupemail", NAME);
msg.username = name;
bad_post_req_test(
NAME,
PASSWORD,
ROUTES.auth.register,
&msg,
ServiceError::EmailTaken,
StatusCode::BAD_REQUEST,
)
.await;
// 3. sigining in with non-existent user
let mut creds = Login {
login: "nonexistantuser".into(),

View file

@ -1,24 +1,36 @@
<. include!("../../components/headers/index.html"); .>
<. include!("../navbar/index.html"); .>
<. include!("../../components/headers/index.html"); .> <.
include!("../navbar/index.html"); .>
<div class="tmp-layout">
<. include!("../header/index.html"); .>
<main class="panel-main">
<!-- Main content container -->
<div class="inner-container">
<!-- Main menu/ important actions roaster -->
<ul class="sitekey-list__box">
<h1 class="sitekey-list__title">Your Notifications</h1>
<. for notification in n.iter() { .>
<li class="sitekey-list__item">
<h3><.= notification.heading .> </h3>
<p>From: <.= notification.name .> </p>
<p>Received: <.= notification.received .> </p>
<p>Message: <.= notification.message .> </p>
<. } .>
</ul>
</div>
<!-- end of container -->
<. include!("../../components/footers.html"); .>
<. include!("../header/index.html"); .>
<main class="panel-main">
<!-- Main content container -->
<div class="inner-container">
<!-- Main menu/ important actions roaster -->
<table class="notification__table">
<thead class="notification__heading">
<th class="notification__title-text">Your Notifications</th>
</thead>
<tbody class="notification__body">
<. for notification in n.iter() { .>
<tr class="notification__item">
<td class="notification__mark-reak">
<button class="notification__mark-read-btn">tick</button>
</td>
<td>
<h3 class="notification__item-heading">
<.= notification.heading .>
</h3>
<p class="notification__item-text"><.= notification.message .></p>
</td>
<td class="notification__sender"><.= notification.name .></td>
<td class="notification__received"><.= notification.received .></td>
</tr>
<. } .>
</tbody>
</table>
</div>
<!-- end of container -->
<. include!("../../components/footers.html"); .>
</div>
</main>
</div>

View file

@ -12,7 +12,6 @@
id="visitor<.= level .>"
/>
</label>
<label class="sitekey-form__level-label" for="difficulty<.= level .>">
Difficulty
<input

View file

@ -12,16 +12,10 @@
<. for sitekey in sitekeys.iter() { .>
<a href="/sitekey/<.= sitekey.key .>/view" class="sitekey-list__item-container">
<li class="sitekey-list__item">
<span class="sitekey-list__name">
<.= sitekey.name .>
</span>
<span class="sitekey-list__key">
<.= sitekey.key .>
</span>
<span class="sitekey-list__name"><.= sitekey.name .></span>
<span class="sitekey-list__key"><.= sitekey.key .></span>
</li>
</a>
<. } .>
</ul>
</div>