void AuthWidget::processEnvironment() { const WEnvironment& env = WApplication::instance()->environment(); if (registrationEnabled_) if (handleRegistrationPath(env.internalPath())) return; std::string emailToken = model_->baseAuth()->parseEmailToken(env.internalPath()); if (!emailToken.empty()) { EmailTokenResult result = model_->processEmailToken(emailToken); switch (result.result()) { case EmailTokenResult::Invalid: displayError(tr("Wt.Auth.error-invalid-token")); break; case EmailTokenResult::Expired: displayError(tr("Wt.Auth.error-token-expired")); break; case EmailTokenResult::UpdatePassword: letUpdatePassword(result.user(), false); break; case EmailTokenResult::EmailConfirmed: displayInfo(tr("Wt.Auth.info-email-confirmed")); User user = result.user(); model_->loginUser(login_, user); } /* * In progressive bootstrap mode, this would cause a redirect w/o * session ID, losing the dialog. */ if (WApplication::instance()->environment().ajax()) WApplication::instance()->setInternalPath("/"); return; } User user = model_->processAuthToken(); model_->loginUser(login_, user, WeakLogin); }
void AuthWidget::processEnvironment() { const WEnvironment& env = WApplication::instance()->environment(); if (registrationEnabled_) if (handleRegistrationPath(env.internalPath())) return; std::string emailToken = model_->baseAuth()->parseEmailToken(env.internalPath()); if (!emailToken.empty()) { EmailTokenResult result = model_->processEmailToken(emailToken); switch (result.result()) { case EmailTokenResult::Invalid: displayError(tr("Wt.Auth.error-invalid-token")); break; case EmailTokenResult::Expired: displayError(tr("Wt.Auth.error-token-expired")); break; case EmailTokenResult::UpdatePassword: letUpdatePassword(result.user(), false); break; case EmailTokenResult::EmailConfirmed: displayInfo(tr("Wt.Auth.info-email-confirmed")); login_.login(result.user()); } WApplication::instance()->setInternalPath("/"); return; } User user = model_->processAuthToken(); if (user.isValid()) login_.login(user, WeakLogin); }
void AuthWidget::onPathChange(const std::string& path) { handleRegistrationPath(path); }