Password reset functionality

On the `reset` page an email address can be submitted. If an account
associated with the submitted email address an email is sent
containing an URL. This URL can be used to set a new password.

- Add GPLv3 for licensing
- Add dependencies
  - `rocket_contrib` to be able to use handlebar templates
  - `anyhow` to handle errors
  - `log` for logging
  - `ldap3` to communicate with a LDAP server
  - `lettre` and `lettre_email` to handle the generation of emails and
    to send them
  - `rand` to generate random keys
- Add `README.org` which is also used to generate `README.md`
- Add configuration parameters
  - domain
  - LDAP
    - server
    - base
    - filter
    - bind
    - password
- Change default development address to 0.0.0.0
- Add structs to handle data
- Add functions to handle password reset actions
  - `reset_prepare()` to generate a new key, send it to the requestor
    and keep it in the memory
  - `set_password()` to check for the key and set the password
- Add routes
- Add tests
- Add templates
  - `reset.html.hbs` to submit an email address
  - `reset_key.html.hbs` to set the new password
This commit is contained in:
finga 2020-07-05 21:12:43 +02:00
parent 6d247c63ba
commit 7b0e4b4a31
10 changed files with 2566 additions and 35 deletions

19
templates/reset.html.hbs Normal file
View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ldap0r</title>
</head>
<body>
{{#if flash}}
<p>{{#if flash_type}}{{flash_type}}: {{/if}}{{ flash }}</p>
{{/if}}
<form action="/reset" method="post" accept-charset="utf-8">
<label for="email">email</label>
<input type="text" name="email" id="email" value="" />
<p><input type="submit" value="submit"></p>
</form>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ldap0r</title>
</head>
<body>
{{#if flash}}
<p>{{#if flash_type}}{{flash_type}}: {{/if}}{{ flash }}</p>
{{/if}}
<form action="/reset/{{ key }}" method="post" accept-charset="utf-8">
<label for="password">password</label>
<input type="password" name="password" id="password" value="" />
<label for="password_control">reenter password</label>
<input type="password" name="password_control" id="password_control" value="" />
<p><input type="submit" value="submit"></p>
</form>
</body>
</html>