mirror of
				https://github.com/avatao-content/baseimage-tutorial-framework
				synced 2025-11-04 11:32:55 +00:00 
			
		
		
		
	Add Login UIModule
This commit is contained in:
		
							
								
								
									
										17
									
								
								src/app/templates/module-login.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/app/templates/module-login.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
<h1>Login page</h1>
 | 
			
		||||
<form id="{{ anchor_id }}_event"
 | 
			
		||||
      action="/login"
 | 
			
		||||
      method="post">
 | 
			
		||||
    {% for type_, id_, label, placeholder in form_data %}
 | 
			
		||||
        <div class="form-group">
 | 
			
		||||
            <label for="{{ id_ }}">{{ label }}</label>
 | 
			
		||||
            <input type="{{ type_ }}"
 | 
			
		||||
                   class="form-control"
 | 
			
		||||
                   id="{{ id_ }}"
 | 
			
		||||
                   name="{{ id_.replace('_input', '') }}"
 | 
			
		||||
                   placeholder="{{ placeholder }}">
 | 
			
		||||
 | 
			
		||||
        </div>
 | 
			
		||||
    {% end %}
 | 
			
		||||
    <button type="submit" class="btn btn-primary">Submit</button>
 | 
			
		||||
</form>
 | 
			
		||||
@@ -1 +1,2 @@
 | 
			
		||||
from .logger import Logger
 | 
			
		||||
from .login import Login
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								src/app/ui_modules/login.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/app/ui_modules/login.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
from tornado.web import UIModule
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Login(UIModule):
 | 
			
		||||
    def render(self, anchor_id, form_data=None):
 | 
			
		||||
        if form_data is None:
 | 
			
		||||
            form_data = (
 | 
			
		||||
                ('email', 'email_input', 'Email address', 'Enter email'),
 | 
			
		||||
                ('password', 'password_input', 'Password', 'Password'),
 | 
			
		||||
            )
 | 
			
		||||
        return self.render_string('module-login.html', anchor_id=anchor_id, form_data=form_data)
 | 
			
		||||
		Reference in New Issue
	
	Block a user