email must be unique

This commit is contained in:
Kim 2023-08-29 11:17:34 +02:00
parent 48191cb7a0
commit 2f403a9819
1 changed files with 3 additions and 2 deletions

View File

@ -148,12 +148,13 @@ public static class SessionMethods
&& Db.Delete(installation);
}
public static Boolean Create(this Session? session, User? newUser)
public static Boolean Create(this Session? session, User newUser)
{
var sessionUser = session?.User;
var userAlreadyExists = Db.GetUserByEmail(newUser.Email);
return sessionUser is not null
&& newUser is not null
&& userAlreadyExists is null
&& sessionUser.HasWriteAccess
&& newUser
.WithParent(sessionUser)