demo user banner

This commit is contained in:
realaravinth 2021-08-09 12:23:06 +05:30
parent 147f563ec8
commit 02b62fb1d0
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
8 changed files with 35 additions and 3 deletions

View file

@ -1,7 +1,7 @@
debug = true
source_code = "https://github.com/mCaptcha/mCaptcha"
commercial = false
allow_demo = false
allow_demo = true
allow_registration = true
[server]

View file

@ -14,7 +14,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::time::Duration;
use actix::clock::sleep;
@ -55,6 +54,7 @@ async fn delete_demo_user(data: &AppData) -> ServiceResult<()> {
pub async fn run(data: AppData, duration: Duration) -> ServiceResult<()> {
register_demo_user(&data).await?;
let fut = async move {
loop {
sleep(duration).await;

View file

@ -47,14 +47,24 @@ body {
position: relative;
}
.auth__secondary-action__banner {
@mixin auth__secondary-action__banner-base {
display: block;
margin: auto;
text-align: center;
width: 80%;
}
.auth__secondary-action__banner {
@include auth__secondary-action__banner-base;
margin: 20px auto auto auto;
}
.auth__demo-user__banner {
@include auth__secondary-action__banner-base;
margin: 5px auto auto auto;
font-size: 0.7rem;
}
.auth__secondary-action__link {
text-decoration: none;
color: $blue-link;

View file

@ -42,3 +42,7 @@ body {
.auth__logo {
width: 120px;
}
.auth__demo-user__cred{
display: block;
}

View file

@ -0,0 +1,12 @@
<. if crate::SETTINGS.allow_demo && crate::SETTINGS.allow_registration { .>
<p class="auth__demo-user__banner">
Try mCaptcha without joining
<br />
<span class="auth__demo-user__cred">
user: <.= crate::demo::DEMO_USER .>
</span>
<span class="auth__demo-user__cred">
password: <.= crate::demo::DEMO_PASSWORD .>
</span>
</p>
<. } .>

View file

@ -46,5 +46,6 @@
Create an account
</a>
</p>
<. include!("../demo-user-banner.html"); .>
</div>
<. include!("../../components/footers.html"); .>

View file

@ -72,5 +72,6 @@
Already have an account?
<a href="<.= crate::PAGES.auth.login .>" class="auth__secondary-action__link">Log in</a>
</p>
<. include!("../demo-user-banner.html"); .>
</div>
<. include!("../../components/footers.html"); .>

View file

@ -27,3 +27,7 @@ $footer-font-size: 14px;
flex: 1;
margin: auto;
}
.details {
margin: auto;
}