A simple example
Here's a simple example of how we could use Albatross Forms to collect a username and password from the user.
We need to define a model class to hold the data:
1 import pwd, crypt
2
3 class Login:
4 def __init__(self, username, password):
5 self.username = username
6 self.password = password
7
8 def is_password_valid(self):
9 crypted_passwd = pwd.getpwent(self.username).pw_passwd
10 crypted_passwd = pwd.getpwnam(username)[1]
11 return (crypt.crypt(self.password, crypted_passwd) == crypted_passwd)
Next, we need to define a form to display the fields:
Create the form in page_enter
XXX need a login button
Render the form using alx-form