This commit is contained in:
parent
f8a38365a6
commit
ad13ac8650
@ -5,6 +5,7 @@ add_library(WebApplication
|
||||
BulmaTheme.h BulmaTheme.cpp
|
||||
HomePage.h HomePage.cpp
|
||||
LoginPage.h LoginPage.cpp
|
||||
RegistrationPage.h RegistrationPage.cpp
|
||||
NavigationBar.h NavigationBar.cpp
|
||||
RedirectPage.h RedirectPage.cpp
|
||||
VisitorRecordsPage.h VisitorRecordsPage.cpp
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "LoginPage.h"
|
||||
#include "Application.h"
|
||||
#include "RegistrationPage.h"
|
||||
#include "model/AuthModel.h"
|
||||
#include <Wt/Auth/AuthService.h>
|
||||
#include <Wt/Auth/PasswordService.h>
|
||||
@ -16,6 +17,14 @@ LoginPage::LoginPage(const Wt::Auth::AuthService &baseAuth, Wt::Auth::AbstractUs
|
||||
// setAttributeValue("style", "transform: translateY(-100px);");
|
||||
}
|
||||
|
||||
std::unique_ptr<Wt::WWidget> LoginPage::createRegistrationView(const Wt::Auth::Identity &id) {
|
||||
auto model = createRegistrationModel();
|
||||
if (id.isValid()) model->registerIdentified(id);
|
||||
auto view = std::make_unique<RegistrationPage>(this);
|
||||
view->setModel(std::move(model));
|
||||
return view;
|
||||
}
|
||||
|
||||
void LoginPage::processExternalEnvironment(const std::string &externalPath, Wt::Auth::AuthService &service) {
|
||||
using namespace Wt::Auth;
|
||||
std::string emailToken;
|
||||
|
@ -7,6 +7,7 @@ class LoginPage : public Wt::Auth::AuthWidget {
|
||||
public:
|
||||
LoginPage(const Wt::Auth::AuthService &baseAuth, Wt::Auth::AbstractUserDatabase &users, Wt::Auth::Login &login);
|
||||
void processExternalEnvironment(const std::string &externalPath, Wt::Auth::AuthService &service);
|
||||
std::unique_ptr<Wt::WWidget> createRegistrationView(const Wt::Auth::Identity &id) final;
|
||||
};
|
||||
|
||||
#endif // __LOGINWIDGET_H__
|
14
WebApplication/RegistrationPage.cpp
Normal file
14
WebApplication/RegistrationPage.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "RegistrationPage.h"
|
||||
#include "LoginPage.h"
|
||||
#include <Wt/WAnchor.h>
|
||||
|
||||
RegistrationPage::RegistrationPage(LoginPage *authWidget) : Wt::Auth::RegistrationWidget(authWidget) {
|
||||
}
|
||||
|
||||
void RegistrationPage::update() {
|
||||
Wt::Auth::RegistrationWidget::update();
|
||||
Wt::WAnchor *isYou = resolve<Wt::WAnchor *>("confirm-is-you");
|
||||
if (isYou != nullptr) {
|
||||
isYou->setLink(Wt::WLink());
|
||||
}
|
||||
}
|
13
WebApplication/RegistrationPage.h
Normal file
13
WebApplication/RegistrationPage.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __REGISTRATIONPAGE_H__
|
||||
#define __REGISTRATIONPAGE_H__
|
||||
|
||||
#include <Wt/Auth/RegistrationWidget.h>
|
||||
|
||||
class LoginPage;
|
||||
|
||||
class RegistrationPage : public Wt::Auth::RegistrationWidget {
|
||||
public:
|
||||
RegistrationPage(LoginPage *authWidget = nullptr);
|
||||
void update() final;
|
||||
};
|
||||
#endif // __REGISTRATIONPAGE_H__
|
@ -202,19 +202,37 @@
|
||||
|
||||
<message id="Wt.Auth.template.password-prompt">
|
||||
<div class="Wt-form Wt-auth-password-prompt">
|
||||
<h2>${tr:Wt.Auth.password-prompt-form-title}</h2>
|
||||
<h2 class="bulma-is-hidden">${tr:Wt.Auth.password-prompt-form-title}</h2>
|
||||
<p>${tr:Wt.Auth.password-prompt-form-info}</p>
|
||||
|
||||
<div class="Wt-fields">
|
||||
<label for="${id:user-name}">${tr:Wt.Auth.user-name}
|
||||
<div class="bulma-field">
|
||||
<label for="${id:user-name}" class="bulma-label">
|
||||
${tr:Wt.Auth.user-name}
|
||||
</label>
|
||||
${user-name}
|
||||
|
||||
${block:Wt.Auth.field password}
|
||||
<div class="bulma-control bulma-has-icons-left">
|
||||
${user-name class="bulma-input" type="text"}
|
||||
<span class="bulma-icon bulma-is-small bulma-is-left">
|
||||
<i class="fa-solid fa-user"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Wt-buttons">
|
||||
${ok-button} ${cancel-button}
|
||||
${<if:password>}
|
||||
<div class="bulma-field">
|
||||
<label for="${id:password}" class="bulma-label">
|
||||
${tr:Wt.Auth.password}
|
||||
</label>
|
||||
<div class="bulma-control bulma-has-icons-left">
|
||||
${password class="bulma-input" type="password"}
|
||||
<span class="bulma-icon bulma-is-small bulma-is-left">
|
||||
<i class="fa-solid fa-lock"></i>
|
||||
</span>
|
||||
</div>
|
||||
${password-info class="Wt-info bulma-help"}
|
||||
</div>
|
||||
${</if:password>}
|
||||
<div class="bulma-field bulma-is-grouped bulma-is-grouped-right">
|
||||
${ok-button class="bulma-is-primary"} ${cancel-button class="bulma-is-light"}
|
||||
</div>
|
||||
</div>
|
||||
</message>
|
||||
|
@ -25,9 +25,7 @@
|
||||
<message id="Wt.Auth.passwdqc.reason-long">
|
||||
超出长度
|
||||
</message>
|
||||
<message id="Wt.Auth.passwdqc.reason-simpleshort">
|
||||
Not enough different characters or classes for this length
|
||||
</message>
|
||||
<message id="Wt.Auth.passwdqc.reason-simpleshort">密码过于简单,请增加字母、数字或符号</message>
|
||||
<message id="Wt.Auth.passwdqc.reason-simple">
|
||||
Not enough different characters or classes
|
||||
</message>
|
||||
@ -37,12 +35,8 @@
|
||||
<message id="Wt.Auth.passwdqc.reason-word">
|
||||
Based on a dictionary word and not a passphrase
|
||||
</message>
|
||||
<message id="Wt.Auth.passwdqc.reason-seq">
|
||||
Based on a common sequence of characters
|
||||
</message>
|
||||
<message id="Wt.Auth.passwdqc.reason-ok">
|
||||
Valid
|
||||
</message>
|
||||
<message id="Wt.Auth.passwdqc.reason-seq">密码只含有常见的字符序列</message>
|
||||
<message id="Wt.Auth.passwdqc.reason-ok">有效</message>
|
||||
|
||||
<message id="Wt.Auth.GoogleService.badresponse">
|
||||
<p>Sorry, could not login using your Google account.</p>
|
||||
@ -112,28 +106,26 @@
|
||||
<message id="Wt.Auth.email-exists">邮箱已经注册</message>
|
||||
<message id="Wt.Auth.oauth">Your external account</message>
|
||||
<message id="Wt.Auth.oauth-info">Choose one of your accounts</message>
|
||||
<message id="Wt.Auth.user-name-exists">User already exists</message>
|
||||
<message id="Wt.Auth.confirm-is-you">User exists, is this you?</message>
|
||||
<message id="Wt.Auth.user-name-exists">用户名已经存在</message>
|
||||
<message id="Wt.Auth.confirm-is-you">用户存在,这是您吗?</message>
|
||||
<message id="Wt.Auth.user-name-tooshort">Min. size {1} characters</message>
|
||||
<message id="Wt.Auth.password-tooshort">Min. size {1} characters</message>
|
||||
<message id="Wt.Auth.passwords-dont-match">Passwords don't match</message>
|
||||
<message id="Wt.Auth.passwords-dont-match">密码不一致</message>
|
||||
<message id="Wt.Auth.registration">注册</message>
|
||||
<message id="Wt.Auth.register">注册</message>
|
||||
<message id="Wt.Auth.error-user-invalid">注册失败</message>
|
||||
<message id="Wt.Auth.email-unverified">请确认您的邮箱</message>
|
||||
<message id="Wt.Auth.confirm-email-first">
|
||||
<h5>Welcome!</h5>
|
||||
|
||||
You will be able to login after confirming your email address using the
|
||||
email we've just sent you.
|
||||
<h5>欢迎!</h5>
|
||||
使用我们刚刚发送给您的电子邮件,确认您的电子邮件地址后,您就可以登录了。
|
||||
</message>
|
||||
|
||||
<!-- PasswordPromptDialog -->
|
||||
|
||||
<message id="Wt.Auth.enter-password">Enter your password</message>
|
||||
<message id="Wt.Auth.password-prompt-form-title">Enter your password</message>
|
||||
<message id="Wt.Auth.enter-password">请输入您的密码</message>
|
||||
<message id="Wt.Auth.password-prompt-form-title">请输入您的密码</message>
|
||||
<message id="Wt.Auth.password-prompt-form-info"></message>
|
||||
<message id="Wt.Auth.password-invalid">Invalid password</message>
|
||||
<message id="Wt.Auth.password-invalid">密码不合法</message>
|
||||
|
||||
<!-- UpdatePasswordWidget -->
|
||||
|
||||
@ -150,8 +142,8 @@
|
||||
|
||||
<!-- Message boxes -->
|
||||
|
||||
<message id="Wt.Auth.error">Error</message>
|
||||
<message id="Wt.Auth.notice">Notice</message>
|
||||
<message id="Wt.Auth.error">错误</message>
|
||||
<message id="Wt.Auth.notice">注意</message>
|
||||
|
||||
<!-- Emails -->
|
||||
|
||||
|
@ -146,15 +146,15 @@
|
||||
<message id="Wt.WMediaPlayer.full-screen">Full screen</message>
|
||||
<message id="Wt.WMediaPlayer.restore-screen">Restore screen</message>
|
||||
|
||||
<message id="Wt.WMessageBox.Abort">Abort</message>
|
||||
<message id="Wt.WMessageBox.Abort">中止</message>
|
||||
<message id="Wt.WMessageBox.Cancel">取消</message>
|
||||
<message id="Wt.WMessageBox.Ignore">Ignore</message>
|
||||
<message id="Wt.WMessageBox.No">No</message>
|
||||
<message id="Wt.WMessageBox.NoToAll">No to All</message>
|
||||
<message id="Wt.WMessageBox.Ok">Ok</message>
|
||||
<message id="Wt.WMessageBox.Retry">Retry</message>
|
||||
<message id="Wt.WMessageBox.Yes">Yes</message>
|
||||
<message id="Wt.WMessageBox.YesToAll">Yes to All</message>
|
||||
<message id="Wt.WMessageBox.Ignore">忽略</message>
|
||||
<message id="Wt.WMessageBox.No">否</message>
|
||||
<message id="Wt.WMessageBox.NoToAll">都不</message>
|
||||
<message id="Wt.WMessageBox.Ok">确认</message>
|
||||
<message id="Wt.WMessageBox.Retry">重试</message>
|
||||
<message id="Wt.WMessageBox.Yes">使得</message>
|
||||
<message id="Wt.WMessageBox.YesToAll">全部是</message>
|
||||
|
||||
<message id="Wt.WOverlayLoadingIndicator.Loading">Loading...</message>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user