1
0
Fork 0

Fix invite empty email

Dieser Commit ist enthalten in:
Daniel García 2019-01-22 17:26:17 +01:00
Ursprung b8cabadd43
Commit ddd49596ba
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: FC8A7D14C3CD543A
2 geänderte Dateien mit 9 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -137,6 +137,10 @@ impl User {
} }
pub fn save(&mut self, conn: &DbConn) -> EmptyResult { 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(); self.updated_at = Utc::now().naive_utc();
diesel::replace_into(users::table) // Insert or update diesel::replace_into(users::table) // Insert or update
@ -213,6 +217,10 @@ impl Invitation {
} }
pub fn save(&mut self, conn: &DbConn) -> EmptyResult { 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) diesel::replace_into(invitations::table)
.values(&*self) .values(&*self)
.execute(&**conn) .execute(&**conn)

Datei anzeigen

@ -65,7 +65,7 @@
} }
function deleteUser(id, mail) { function deleteUser(id, mail) {
var input_mail = prompt("To delete user '" + mail + "', please type the name below") var input_mail = prompt("To delete user '" + mail + "', please type the name below")
if (input_mail) { if (input_mail != null) {
if (input_mail == mail) { if (input_mail == mail) {
_post("/admin/users/" + id + "/delete", _post("/admin/users/" + id + "/delete",
"User deleted correctly", "User deleted correctly",