55 lines
2.2 KiB
Python
55 lines
2.2 KiB
Python
from scaffold.core.widget import base_widget
|
|
|
|
class control(base_widget):
|
|
oauth_enabled = set()
|
|
css = '../scaffold/www/default_widgets/css/loginBox.css'
|
|
|
|
def create(self):
|
|
return self
|
|
|
|
def enable_oauth(self, name):
|
|
self.oauth_enabled.add(name)
|
|
return self
|
|
|
|
def render(self):
|
|
htm = '<div id="login_box" class="row">'
|
|
|
|
htm += '<p>Please login with one of the oauth provider below, which is more secure and does not store passwords on our system.</p>'
|
|
if self.oauth_enabled:
|
|
htm += '<div class="providers">'
|
|
if 'google' in self.oauth_enabled:
|
|
htm += '<a title="Login with Google" class="but row" href="/oauth/google/login">Login with Google</a> '
|
|
if 'facebook' in self.oauth_enabled:
|
|
htm += '<a title="Login with facebook" class="but row" href="/oauth/facebook/login">Login with Facebook</a> '
|
|
if 'github' in self.oauth_enabled:
|
|
htm += '<a title="Login with twitter" class="but row" href="/oauth/github/login">Login with GitHub</a>'
|
|
htm += '<br /></div>'
|
|
|
|
htm += '<p>Or alternatively login with your previously created account.</p>'
|
|
htm += '''
|
|
<form class="col s12" id="user_login" method="post" action="/login" ><frameset>
|
|
|
|
<div class="row">
|
|
<div class="input-field col s12">
|
|
<input id="username" name="username" type="text"/>
|
|
<label for="username">E-Mail</label>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="input-field col s12">
|
|
<input id="password" name="password" type="password"/>
|
|
<label for="password">Password</label>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="input-field col s12">
|
|
<button class="but" form="user_login" type="submit" value="login">Login</button>
|
|
</div>
|
|
</div>
|
|
|
|
</frameset></form>
|
|
<a href="/register">Register for an account</a> | <a href="/reset-password">Reset password</a>'''
|
|
htm += '</div>'
|
|
return htm
|
|
|