Пример #1
0
 if ($openid && $password) {
     // but you can add OpenID identities later
     throw new EscapedException(t("You cannot use both OpenID and password at login."));
 }
 if ($logout) {
     User::logout(db());
     $messages[] = t("Successfully logged out. You may login again here.");
 } else {
     if (!require_get("pause", false)) {
         $user = false;
         try {
             if ($oauth2) {
                 $args = array('oauth2' => $oauth2);
                 $url = absolute_url(url_for('login', $args));
                 $provider = Users\OAuth2Providers::createProvider($oauth2, $url);
                 $user = Users\UserOAuth2::tryLogin(db(), $provider, $url);
             } else {
                 if ($openid) {
                     // we want to add the openid identity URL to the return address
                     // (the return URL is also verified in validate())
                     $args = array("openid" => $openid);
                     if ($autologin) {
                         $args["autologin"] = $autologin;
                     }
                     if ($destination) {
                         $args["destination"] = $destination;
                     }
                     $user = Users\UserOpenID::tryLogin(db(), $openid, absolute_url(url_for('login', $args)));
                 } else {
                     if ($email && $password) {
                         // email/password login
Пример #2
0
 if (!$errors) {
     try {
         $user = false;
         try {
             if ($oauth2) {
                 // try OAuth2 signup
                 // save parameters for callback later
                 $_SESSION['signup_name'] = $name;
                 $_SESSION['signup_email'] = $email;
                 $_SESSION['signup_country'] = $country;
                 $_SESSION['signup_agree'] = $agree;
                 $_SESSION['signup_subscribe'] = $subscribe;
                 $args = array('oauth2' => $oauth2);
                 $url = absolute_url(url_for('signup', $args));
                 $provider = Users\OAuth2Providers::createProvider($oauth2, $url);
                 $user = Users\UserOAuth2::trySignup(db(), $provider, $url);
             } else {
                 if ($openid) {
                     // try OpenID signup
                     // we want to add the openid identity URL to the return address
                     // (the return URL is also verified in validate())
                     $args = array('openid' => $openid, 'submit' => 1, 'name' => $name, 'email' => $email, 'country' => $country, 'agree' => $agree, 'subscribe' => $subscribe);
                     // persist session ID (to keep referer) if the user hasn't saved cookie
                     if (session_name()) {
                         $args[session_name()] = session_id();
                     }
                     $url = absolute_url(url_for('signup', $args));
                     $user = Users\UserOpenID::trySignup(db(), $email, $openid, $url);
                 } else {
                     if ($email && $password) {
                         // try email/password signup