fixing bug in updating user
This commit is contained in:
parent
1021bb852a
commit
b6fbeb48b5
|
@ -157,6 +157,7 @@ public static class SessionMethods
|
||||||
.Do(() => newUser.Password = newUser.SaltAndHashPassword(newUser.Password))
|
.Do(() => newUser.Password = newUser.SaltAndHashPassword(newUser.Password))
|
||||||
.Do(() => newUser.MustResetPassword = true)
|
.Do(() => newUser.MustResetPassword = true)
|
||||||
.Apply(Db.Create);
|
.Apply(Db.Create);
|
||||||
|
|
||||||
// && Mailer.Mailer.SendVerificationMessage(newUser);
|
// && Mailer.Mailer.SendVerificationMessage(newUser);
|
||||||
|
|
||||||
//Send Email to new user to verify email and set password
|
//Send Email to new user to verify email and set password
|
||||||
|
@ -172,7 +173,7 @@ public static class SessionMethods
|
||||||
&& sessionUser is not null
|
&& sessionUser is not null
|
||||||
&& originalUser is not null
|
&& originalUser is not null
|
||||||
&& sessionUser.HasWriteAccess
|
&& sessionUser.HasWriteAccess
|
||||||
&& sessionUser.HasAccessTo(editedUser)
|
&& sessionUser.HasAccessTo(originalUser)
|
||||||
&& editedUser
|
&& editedUser
|
||||||
.WithParentOf(originalUser) // prevent moving
|
.WithParentOf(originalUser) // prevent moving
|
||||||
.WithNameOf(originalUser)
|
.WithNameOf(originalUser)
|
||||||
|
|
|
@ -18,11 +18,13 @@ public static partial class Db
|
||||||
public static Boolean Update(User user)
|
public static Boolean Update(User user)
|
||||||
{
|
{
|
||||||
var originalUser = GetUserById(user.Id);
|
var originalUser = GetUserById(user.Id);
|
||||||
|
if (originalUser is null) return false;
|
||||||
|
|
||||||
return originalUser is not null
|
// these columns must not be modified!
|
||||||
&& user.ParentId == originalUser.ParentId // these columns must not be modified!
|
user.ParentId = originalUser.ParentId;
|
||||||
&& user.Name == originalUser.Name
|
user.Name = originalUser.Name;
|
||||||
&& Connection.Update(user) > 0;
|
|
||||||
|
return Connection.Update(user) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue