mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
Скрипт привязки к ASFramework
This commit is contained in:
parent
5af607327b
commit
742e432657
1 changed files with 56 additions and 0 deletions
56
compat/auth/asframework.php
Normal file
56
compat/auth/asframework.php
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace controllers;
|
||||||
|
use \Account;
|
||||||
|
use \app;
|
||||||
|
use \AccountException;
|
||||||
|
/**
|
||||||
|
* Description of minecraftController
|
||||||
|
*
|
||||||
|
* @author gravit
|
||||||
|
*/
|
||||||
|
const SECRET_AUTH_KEY = "8k37Jm4l33jQw88eRo9LV";
|
||||||
|
class minecraftController extends \Controller {
|
||||||
|
//put your code here
|
||||||
|
public function request($args) {
|
||||||
|
\helpers\ajaxHelper::returnStatus(400);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAction($args) {
|
||||||
|
api\userAction::getuserAction($args);
|
||||||
|
}
|
||||||
|
public function checkAuthAction($args)
|
||||||
|
{
|
||||||
|
if($args['access_key'] !== SECRET_AUTH_KEY)
|
||||||
|
{
|
||||||
|
echo 'server access key incorrect';
|
||||||
|
app::stop();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$acc = new Account();
|
||||||
|
$acc->auth($args['login'],$args['pass']);
|
||||||
|
echo 'OK:'.$acc->login.'';
|
||||||
|
app::stop();
|
||||||
|
} catch (AccountException $e) {
|
||||||
|
$msg = $e->getMessage();
|
||||||
|
if ($msg == AccountException::AuthError) {
|
||||||
|
echo 'Login or password is incorrect';
|
||||||
|
app::stop();
|
||||||
|
}
|
||||||
|
if ($msg == AccountException::NoLoginError) {
|
||||||
|
echo 'This account is not allowed to sign in';
|
||||||
|
app::stop();
|
||||||
|
}
|
||||||
|
if ($msg == AccountException::FatalBanError) {
|
||||||
|
echo 'You are permanently banned';
|
||||||
|
app::stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue