Merge branch 'feat-password-history' of https://github.com/appwrite/appwrite into feat-password-history
This commit is contained in:
commit
e1cf464bcb
2 changed files with 4 additions and 3 deletions
|
@ -498,6 +498,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$userId = ID::unique();
|
$userId = ID::unique();
|
||||||
|
$password = Auth::passwordHash(Auth::passwordGenerator(), Auth::DEFAULT_ALGO, Auth::DEFAULT_ALGO_OPTIONS);
|
||||||
$user = Authorization::skip(fn() => $dbForProject->createDocument('users', new Document([
|
$user = Authorization::skip(fn() => $dbForProject->createDocument('users', new Document([
|
||||||
'$id' => $userId,
|
'$id' => $userId,
|
||||||
'$permissions' => [
|
'$permissions' => [
|
||||||
|
@ -508,8 +509,8 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'emailVerification' => true,
|
'emailVerification' => true,
|
||||||
'status' => true, // Email should already be authenticated by OAuth2 provider
|
'status' => true, // Email should already be authenticated by OAuth2 provider
|
||||||
'passwordHistory' => $passwordHistory > 0 ? [Auth::passwordHash(Auth::passwordGenerator(), Auth::DEFAULT_ALGO, Auth::DEFAULT_ALGO_OPTIONS)] : null,
|
'passwordHistory' => $passwordHistory > 0 ? [$password] : null,
|
||||||
'password' => Auth::passwordHash(Auth::passwordGenerator(), Auth::DEFAULT_ALGO, Auth::DEFAULT_ALGO_OPTIONS),
|
'password' => $password,
|
||||||
'hash' => Auth::DEFAULT_ALGO,
|
'hash' => Auth::DEFAULT_ALGO,
|
||||||
'hashOptions' => Auth::DEFAULT_ALGO_OPTIONS,
|
'hashOptions' => Auth::DEFAULT_ALGO_OPTIONS,
|
||||||
'passwordUpdate' => null,
|
'passwordUpdate' => null,
|
||||||
|
|
|
@ -56,7 +56,7 @@ class V18 extends Migration
|
||||||
$this->createAttributeFromCollection($this->projectDB, $id, 'passwordHistory');
|
$this->createAttributeFromCollection($this->projectDB, $id, 'passwordHistory');
|
||||||
$this->projectDB->deleteCachedCollection($id);
|
$this->projectDB->deleteCachedCollection($id);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
Console::warning("'region' from {$id}: {$th->getMessage()}");
|
Console::warning("'passwordHistory' from {$id}: {$th->getMessage()}");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue