PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/app/_sso/main.php

https://gitlab.com/Ltaimao/wecenter
PHP | 78 lines | 54 code | 12 blank | 12 comment | 9 complexity | 9a2a4d0839f8cd93d80994c825f0c02e MD5 | raw file
  1. <?php
  2. /*
  3. +--------------------------------------------------------------------------
  4. | WeCenter [#RELEASE_VERSION#]
  5. | ========================================
  6. | by WeCenter Software
  7. | © 2011 - 2014 WeCenter. All Rights Reserved
  8. | http://www.wecenter.com
  9. | ========================================
  10. | Support: WeCenter@qq.com
  11. |
  12. +---------------------------------------------------------------------------
  13. */
  14. if (!defined('IN_ANWSION'))
  15. {
  16. die;
  17. }
  18. class main extends AWS_CONTROLLER
  19. {
  20. public function get_access_rule()
  21. {
  22. $rule_action['rule_type'] = 'black'; //黑名单,黑名单中的检查 'white'白名单,白名单以外的检查
  23. $rule_action['actions'] = array();
  24. return $rule_action;
  25. }
  26. public function login_process_action()
  27. {
  28. if (get_setting('ucenter_enabled') == 'Y')
  29. {
  30. if (!$user_info = $this->model('ucenter')->login($_GET['user_name'], $_GET['password']))
  31. {
  32. $user_info = $this->model('account')->check_login($_GET['user_name'], $_GET['password']);
  33. }
  34. }
  35. else
  36. {
  37. $user_info = $this->model('account')->check_login($_GET['user_name'], $_GET['password']);
  38. }
  39. if ($user_info)
  40. {
  41. if ($user_info['forbidden'] == 1)
  42. {
  43. echo jsonp_encode(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('抱歉, 你的账号已经被禁止登录')));
  44. }
  45. if ($_POST['net_auto_login'])
  46. {
  47. $expire = 60 * 60 * 24 * 360;
  48. }
  49. $this->model('account')->update_user_last_login($user_info['uid']);
  50. $this->model('account')->logout();
  51. $this->model('account')->setcookie_login($user_info['uid'], $_GET['user_name'], $_GET['password'], $user_info['salt'], $expire);
  52. echo jsonp_encode(AWS_APP::RSM(null, 1, null));
  53. }
  54. else
  55. {
  56. echo jsonp_encode(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入正确的帐号或密码')));
  57. }
  58. }
  59. public function check_hash_login_action()
  60. {
  61. if ($user_info = $this->model('account')->check_hash_login($_POST['user_name'], $_POST['password']))
  62. {
  63. echo json_encode($user_info);
  64. }
  65. }
  66. }