email must be unique
This commit is contained in:
parent
48191cb7a0
commit
2f403a9819
|
@ -148,12 +148,13 @@ public static class SessionMethods
|
||||||
&& Db.Delete(installation);
|
&& 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 sessionUser = session?.User;
|
||||||
|
var userAlreadyExists = Db.GetUserByEmail(newUser.Email);
|
||||||
|
|
||||||
return sessionUser is not null
|
return sessionUser is not null
|
||||||
&& newUser is not null
|
&& userAlreadyExists is null
|
||||||
&& sessionUser.HasWriteAccess
|
&& sessionUser.HasWriteAccess
|
||||||
&& newUser
|
&& newUser
|
||||||
.WithParent(sessionUser)
|
.WithParent(sessionUser)
|
||||||
|
|
Loading…
Reference in New Issue