Add expire defaults
This commit is contained in:
parent
559fa924c0
commit
70ea6734e7
1 changed files with 7 additions and 0 deletions
|
@ -2,12 +2,14 @@
|
|||
|
||||
namespace Appwrite\Migration\Version;
|
||||
|
||||
use Appwrite\Auth\Auth;
|
||||
use Appwrite\Migration\Migration;
|
||||
use Exception;
|
||||
use PDOException;
|
||||
use Throwable;
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\DateTime;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Database\Exception\Authorization;
|
||||
use Utopia\Database\Exception\Duplicate;
|
||||
|
@ -525,6 +527,11 @@ class V20 extends Migration
|
|||
$this->projectDB->createDocument('targets', $target);
|
||||
}
|
||||
break;
|
||||
case 'sessions':
|
||||
$duration = $this->project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG;
|
||||
$expire = DateTime::addSeconds(new \DateTime(), $duration);
|
||||
$document->setAttribute('expire', $expire);
|
||||
break;
|
||||
}
|
||||
return $document;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue