Check session token
This commit is contained in:
parent
8ae21d491a
commit
3934f6a663
@ -23,6 +23,9 @@ class SessionController extends Controller{
|
|||||||
try {
|
try {
|
||||||
$token = Helper::getArrayValueByKey($args, 'token');
|
$token = Helper::getArrayValueByKey($args, 'token');
|
||||||
$file = File::getByShareToken($token);
|
$file = File::getByShareToken($token);
|
||||||
|
if ($file->isPasswordProtected() && !$file->checkPassword('')){
|
||||||
|
throw new \Exception('Not authorized');
|
||||||
|
}
|
||||||
$session = Db\Session::start($uid, $file);
|
$session = Db\Session::start($uid, $file);
|
||||||
\OCP\JSON::success($session);
|
\OCP\JSON::success($session);
|
||||||
} catch (\Exception $e){
|
} catch (\Exception $e){
|
||||||
|
@ -95,7 +95,7 @@ class File {
|
|||||||
public function isPasswordProtected(){
|
public function isPasswordProtected(){
|
||||||
return $this->passwordProtected;
|
return $this->passwordProtected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkPassword($password){
|
public function checkPassword($password){
|
||||||
$shareId = $this->getShareId();
|
$shareId = $this->getShareId();
|
||||||
if (!$this->isPasswordProtected()
|
if (!$this->isPasswordProtected()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user