Finished converting the register page to use the new templates.

This commit is contained in:
Relintai 2024-02-26 22:07:02 +01:00
parent 9e21d5aab8
commit 15e23dbedf
2 changed files with 48 additions and 118 deletions

View File

@ -11,86 +11,42 @@
</div> </div>
[ Register ] [ Register ]
func render_register_default(request: WebServerRequest, data: Dictionary) -> void: <div class="row mb-4">
var b : HTMLBuilder = HTMLBuilder.new() <div class="col-2"></div>
<div class="col-8"> <h2>Registration</h2></div>
<div class="col-2"></div>
</div>
{{ pr(error_str) }}
<div class="row mb-4">
<div class="col-2"></div>
# Title <div class="col-8">
b.div("row mb-4") <form method="POST">
b.div("col-2")
b.cdiv()
b.div("col-8") <div class="form-group">
<label for="username_input" class="form_label">Username</label>
<input type="text" name="username" {{ qvf(uname_val, 'value="%s"', uname_val)) }} class="form-control" id="username_input">
</div>
b.h2() <div class="form-group">
b.w("Registration") <label for="email_input" class="form_label">Email</label>
b.ch2() <input type="text" name="email" {{ qvf(email_val, 'value="%s"', email_val)) }} class="form-control" id="email_input">
</div>
b.cdiv() <div class="form-group">
<label for="password_input" class="form_label">Password</label>
<input type="password" name="password" placeholder="*******" class="form-control" id="password_input">
</div>
b.div("col-2") <div class="form-group">
b.cdiv() <label for="password_check_input" class="form_label">Password again</label>
b.cdiv() <input type="password" name="password_check" placeholder="*******" class="form-control" id="password_check_input">
</div>
# Errors <button type="submit" class="btn btn-outline-primary mt-3">Register</button>
var error_str : String = data["error_str"] </form>
</div>
if !error_str.empty(): <div class="col-2"></div>
b.div("row mb-4") </div>
b.div("col-2")
b.cdiv()
b.div("col-8")
b.div("alert alert-danger").attrib("role", "alert")
b.w(error_str)
b.cdiv()
b.cdiv()
b.div("col-2")
b.cdiv()
b.cdiv()
# Form
b.div("row")
b.div("col-2")
b.cdiv()
b.div("col-8")
if true:
b.form().method_post()
b.csrf_tokenr(request)
b.div("form-group")
b.label().fora("username_input").cls("form_label").f().w("Username").clabel()
b.input_text("username", data["uname_val"], "", "form-control", "username_input")
b.cdiv()
b.div("form-group")
b.label().fora("email_input").cls("form_label").f().w("Email").clabel()
b.input_text("email", data["email_val"], "", "form-control", "email_input")
b.cdiv()
b.div("form-group")
b.label().fora("password_input").cls("form_label").f().w("Password").clabel()
b.input_password("password", "", "*******", "form-control", "password_input")
b.cdiv()
b.div("form-group")
b.label().fora("password_check_input").cls("form_label").f().w("Password again").clabel()
b.input_password("password_check", "", "*******", "form-control", "password_check_input")
b.cdiv()
b.button().type("submit").cls("btn btn-outline-primary mt-3").f().w("Register").cbutton()
b.cform()
b.cdiv()
b.div("col-2")
b.cdiv()
b.cdiv()
b.write_tag()
request.body += b.result
request.compile_and_send_body()

View File

@ -1,42 +1,16 @@
[ RegisterSuccess ] [ RegisterSuccess ]
func render_register_success(request: WebServerRequest, data: Dictionary) -> void: <div class="row mb-4">
var b : HTMLBuilder = HTMLBuilder.new() <div class="col-2"></div>
<div class="col-8"> <h2>Registration successful!</h2></div>
<div class="col-2"></div>
</div>
<div class="row mb-4">
<div class="col-2"></div>
<div class="col-8">
Login Here:<br>
<a href="{{ redirect_on_success_url }}">{{ ">> Login <<" }}</a>
</div>
<div class="col-2"></div>
</div>
# Title
b.div("row mb-4")
b.div("col-2")
b.cdiv()
b.div("col-8")
b.h2()
b.w("Registration successful!")
b.ch2()
b.cdiv()
b.div("col-2")
b.cdiv()
b.cdiv()
# msg
b.div("row")
b.div("col-2")
b.cdiv()
b.div("col-8")
b.w("Login Here:").br()
b.br()
b.a(redirect_on_success_url)
b.w(">> Login <<")
b.ca()
b.cdiv()
b.div("col-2")
b.cdiv()
b.cdiv()
b.write_tag()
request.body += b.result
request.compile_and_send_body()