Преглед изворни кода

Allow email field to be changed.

Alan Lam пре 8 година
родитељ
комит
6cadab850b
1 измењених фајлова са 2 додато и 0 уклоњено
  1. 2 0
      controllers/user_edit.php

+ 2 - 0
controllers/user_edit.php

@@ -30,6 +30,7 @@ if($submit) {
 		}
 
 		$user->level = http::value("level", "int");
+		$user->email = http::value("email", "email");
 		$user->title = http::value("title", "trim");
 		$user->first_name = http::value("first_name", "trim");
 		$user->last_name = http::value("last_name", "trim");
@@ -51,6 +52,7 @@ if($submit) {
 		if($form_exception->hasErrors()) throw $form_exception;
 
 		$success = $user->commit();
+		if(!$success) throw new Exception("User was not updated successfully. If the email was changed, another user may already be using that address.");
 
 		Core::addAlert("success", "User updated successfully.");
 		HTTP::redirect("/account/users/$id/edit");