dupe email check and notifications table

This commit is contained in:
realaravinth
2021-07-13 21:23:08 +05:30
parent 47cca5c9a7
commit 558dbef712
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") { if msg.contains("mcaptcha_users_name_key") {
return Err(ServiceError::UsernameTaken); return Err(ServiceError::UsernameTaken);
} else if msg.contains("mcaptcha_users_email_key") { } else if msg.contains("mcaptcha_users_email_key") {
return Err(ServiceError::UsernameTaken); return Err(ServiceError::EmailTaken);
} else if msg.contains("mcaptcha_users_secret_key") { } else if msg.contains("mcaptcha_users_secret_key") {
continue; continue;
} else { } else {

View File

@@ -59,7 +59,7 @@ async fn auth_works() {
signin(EMAIL, PASSWORD).await; signin(EMAIL, PASSWORD).await;
// 2. check if duplicate username is allowed // 2. check if duplicate username is allowed
let msg = Register { let mut msg = Register {
username: NAME.into(), username: NAME.into(),
password: PASSWORD.into(), password: PASSWORD.into(),
confirm_password: PASSWORD.into(), confirm_password: PASSWORD.into(),
@@ -75,6 +75,18 @@ async fn auth_works() {
) )
.await; .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 // 3. sigining in with non-existent user
let mut creds = Login { let mut creds = Login {
login: "nonexistantuser".into(), login: "nonexistantuser".into(),

View File

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

View File

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

View File

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