wip: login redirect

This commit is contained in:
Swrup 2022-02-20 18:02:25 +01:00
parent 6a84f3dc94
commit 7e9effa723
5 changed files with 41 additions and 32 deletions

View file

@ -1,24 +1,13 @@
let f ?nick ?password request =
% begin match nick, password with
% | Some nick, Some password ->
% begin match User.login ~nick ~password request with
% | Error e ->
Error: <%s e %>
% | Ok () ->
Logged in ! Happy planting XD
% end;
% | _ ->
<%s! Dream.form_tag ~action:"/login" request %>
<div class="mb-3">
<label for="nick" class="form-label">Nick</label>
<input name="nick" type="text" class="form-control" id="nick" aria-describedby="nickHelp">
<div id="nickHelp" class="form-text">Who are u ?</div>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input name="password" type="password" class="form-control" id="password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
% end;
let f request =
<%s! Dream.form_tag ~action:"/login" request %>
<div class="mb-3">
<label for="nick" class="form-label">Nick</label>
<input name="nick" type="text" class="form-control" id="nick" aria-describedby="nickHelp">
<div id="nickHelp" class="form-text">Who are u ?</div>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input name="password" type="password" class="form-control" id="password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>