Beispiel #1
0
 public function deactivate()
 {
     $user = Sentinel::check();
     Activation::remove($user);
     return Redirect::back()->withSuccess('Account deactivated.');
 }
Beispiel #2
0
        // Check if the options exists, then if the value compares otherwise update it.
        if (Options::exists($dateOption)) {
            // Compare the posted value to the value in the DB and update it if neccesarry
            if (htmlspecialchars(Options::userGet($userId, $dateOption)) !== htmlspecialchars($timestamp)) {
                // Set the option to the new value
                Options::userSet($userId, $dateOption, $timestamp);
                $changes = true;
            }
        }
    }
    if (isset($_POST['action']) && $_POST['action'] == 'Save Changes') {
        // These are the 2 static things in your account a password and a email address
        if (isset($_POST['user-email']) && $Error->email($_POST['user-email'], false) && $_POST['user-email'] !== $u->email) {
            $u->email = $_POST['user-email'];
            $u->update();
            Activation::remove($userId);
            $link = full_url_to_script('activate.php') . "?action=activate&code=" . Activation::generate($userId) . "&id=" . $userId;
            Emailtemplate::setBaseDir('./assets/email_templates');
            $html = Emailtemplate::loadTemplate('reactivate', array('title' => 'Reactivation Email', 'prettyName' => Options::get('prettyName'), 'name' => $u->username, 'siteName' => Options::get('emailName'), 'activationLink' => $link, 'footerLink' => Options::get('siteName'), 'footerEmail' => Options::get('emailInfo')));
            send_html_mail(array($u->username => $u->email), 'Reactivation Email', $html, array(Options::get('siteName') => Options::get('emailAdmin')));
            $Error->add('info', '<strong>Logged Out</strong><br />We have sent you a reactivation email to the new email address in order to verify it. Please check your email and follow the link within.');
            $Auth->logout();
        }
        // These are the 2 static things in your account a password and a email address
        if (isset($_POST['user-password']) && $_POST['user-password'] !== $inputValue[1] && $_POST['user-password'] !== '') {
            Auth::changePassword($u->id, $_POST['user-password']);
            $Error->add('info', '<strong>Logged Out</strong><br />Password updated, you may login with your new password');
            $Auth->logout();
        }
    }
}
 /**
  * @Given the activation has expired
  */
 public function theActivationHasExpired()
 {
     Activation::remove(Sentinel::findById(1));
 }
Beispiel #4
0
    Activation::complete($user, $activation->code);
    // $code = $activation->code;
    // $sent = Mail::send('sentinel.emails.activate', compact('user', 'code'), function($m) use ($user)
    // {
    //  $m->to($user->email)->subject('Activate Your Account');
    // });
    // if ($sent === 0)
    // {
    //  return Redirect::to('register')
    //      ->withErrors('Failed to send activation email.');
    // }
    return Redirect::to('account')->withSuccess('Account activated.');
})->where('id', '\\d+');
Route::get('deactivate', function () {
    $user = Sentinel::check();
    Activation::remove($user);
    return Redirect::back()->withSuccess('Account deactivated.');
});
Route::get('reset', function () {
    return View::make('sentinel.reset.begin');
});
Route::post('reset', function () {
    $rules = ['email' => 'required|email'];
    $validator = Validator::make(Input::get(), $rules);
    if ($validator->fails()) {
        return Redirect::back()->withInput()->withErrors($validator);
    }
    $email = Input::get('email');
    $user = Sentinel::findByCredentials(compact('email'));
    if (!$user) {
        return Redirect::back()->withInput()->withErrors('No user with that email address belongs in our system.');
 /**
  * Deactivates the given user.
  *
  * @param  int  $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function deactivate($id)
 {
     Activation::remove(Sentinel::findById($id));
     return Redirect::route('user.edit', $id)->withSuccess(trans('users/messages.success.deactivate'));
 }