Daniel García
6 years ago
No known key found for this signature in database
GPG Key ID: FC8A7D14C3CD543A
2 changed files with
9 additions and
1 deletions
-
src/db/models/user.rs
-
src/static/templates/admin/page.hbs
|
|
@ -137,6 +137,10 @@ impl User { |
|
|
|
} |
|
|
|
|
|
|
|
pub fn save(&mut self, conn: &DbConn) -> EmptyResult { |
|
|
|
if self.email.trim().is_empty() { |
|
|
|
err!("User email can't be empty") |
|
|
|
} |
|
|
|
|
|
|
|
self.updated_at = Utc::now().naive_utc(); |
|
|
|
|
|
|
|
diesel::replace_into(users::table) // Insert or update
|
|
|
@ -213,6 +217,10 @@ impl Invitation { |
|
|
|
} |
|
|
|
|
|
|
|
pub fn save(&mut self, conn: &DbConn) -> EmptyResult { |
|
|
|
if self.email.trim().is_empty() { |
|
|
|
err!("Invitation email can't be empty") |
|
|
|
} |
|
|
|
|
|
|
|
diesel::replace_into(invitations::table) |
|
|
|
.values(&*self) |
|
|
|
.execute(&**conn) |
|
|
|
|
|
@ -65,7 +65,7 @@ |
|
|
|
} |
|
|
|
function deleteUser(id, mail) { |
|
|
|
var input_mail = prompt("To delete user '" + mail + "', please type the name below") |
|
|
|
if (input_mail) { |
|
|
|
if (input_mail != null) { |
|
|
|
if (input_mail == mail) { |
|
|
|
_post("/admin/users/" + id + "/delete", |
|
|
|
"User deleted correctly", |
|
|
|