Added registration link.
Added smtp transport.
This commit is contained in:
parent
9b8bdce543
commit
0797f5799c
@ -43,6 +43,7 @@ security.salt = secretsalt
|
|||||||
|
|
||||||
mail.on = false
|
mail.on = false
|
||||||
mail.manager = immediate
|
mail.manager = immediate
|
||||||
|
mail.transport = smtp
|
||||||
mail.smtp.server = mail.mydomain.com
|
mail.smtp.server = mail.mydomain.com
|
||||||
mail.smtp.username = mymailusername
|
mail.smtp.username = mymailusername
|
||||||
mail.smtp.password = mymailpassword
|
mail.smtp.password = mymailpassword
|
||||||
|
@ -1 +1 @@
|
|||||||
/home/raoul/VirtualEnv/ScribeEngine/trunk/bin/paster serve development.ini --reload
|
/home/raoul/VirtualEnv/ScribeEngine/registration/bin/paster serve development.ini --reload
|
||||||
|
@ -90,11 +90,14 @@ class AdminController(BaseController):
|
|||||||
log.debug('Logging in as "%s" with password "%s"', c.form_values[u'email'], c.form_values[u'password'])
|
log.debug('Logging in as "%s" with password "%s"', c.form_values[u'email'], c.form_values[u'password'])
|
||||||
user = Session.query(User).filter_by(email=c.form_values[u'email']).first()
|
user = Session.query(User).filter_by(email=c.form_values[u'email']).first()
|
||||||
password = utils.hash_password(c.form_values[u'password'])
|
password = utils.hash_password(c.form_values[u'password'])
|
||||||
log.debug(user)
|
|
||||||
if not user or user.password != password:
|
if not user or user.password != password:
|
||||||
log.debug('Username or password are incorrect.')
|
log.debug('Username or password are incorrect.')
|
||||||
h.flash.set_message(u'Your username or password are incorrect.', u'error')
|
h.flash.set_message(u'Your username or password are incorrect.', u'error')
|
||||||
h.redirect_to('/admin/login')
|
h.redirect_to(h.url_for(action=u'login'))
|
||||||
|
elif user and user.activation_key is not None:
|
||||||
|
log.debug('Unactivated account.')
|
||||||
|
h.flash.set_message(u'Your account has not yet been activated. Please check your e-mail for a link to activate your account.', u'error')
|
||||||
|
h.redirect_to(h.url_for(action=u'login'))
|
||||||
elif user and user.password == password:
|
elif user and user.password == password:
|
||||||
log.debug('Logged in successfully.')
|
log.debug('Logged in successfully.')
|
||||||
redirect_url = str(session.get(u'redirect_url', u'/'))
|
redirect_url = str(session.get(u'redirect_url', u'/'))
|
||||||
@ -109,7 +112,7 @@ class AdminController(BaseController):
|
|||||||
del session[u'REMOTE_USER']
|
del session[u'REMOTE_USER']
|
||||||
session.save()
|
session.save()
|
||||||
h.flash.set_message(u'There was a problem logging you in.', u'error')
|
h.flash.set_message(u'There was a problem logging you in.', u'error')
|
||||||
h.redirect_to('/admin/login')
|
h.redirect_to(h.url_for(action=u'login'))
|
||||||
|
|
||||||
def logout(self):
|
def logout(self):
|
||||||
del session[u'REMOTE_USER']
|
del session[u'REMOTE_USER']
|
||||||
|
@ -100,10 +100,10 @@ users_table = Table(u'users', metadata,
|
|||||||
Column(u'email', Unicode(200), nullable=False, index=True),
|
Column(u'email', Unicode(200), nullable=False, index=True),
|
||||||
Column(u'password', Unicode(64), nullable=False),
|
Column(u'password', Unicode(64), nullable=False),
|
||||||
Column(u'nick', Unicode(50), nullable=False, index=True),
|
Column(u'nick', Unicode(50), nullable=False, index=True),
|
||||||
Column(u'first_name', Unicode(100)),
|
Column(u'first_name', Unicode(100), default=u''),
|
||||||
Column(u'last_name', Unicode(100)),
|
Column(u'last_name', Unicode(100), default=u''),
|
||||||
Column(u'homepage', Unicode(200)),
|
Column(u'homepage', Unicode(200), default=u''),
|
||||||
Column(u'activation_key', Unicode(40))
|
Column(u'activation_key', Unicode(40), default=None)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Definition of the "variables" table
|
# Definition of the "variables" table
|
||||||
|
@ -404,6 +404,10 @@ fieldset {
|
|||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#register-now {
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
/* Message areas */
|
/* Message areas */
|
||||||
|
|
||||||
#form-errors {
|
#form-errors {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<input type="submit" name="action" value="Login" class="form-button"/>
|
<input type="submit" name="action" value="Login" class="form-button"/>
|
||||||
|
<span id="register-now">No account? <a href="${h.url_for(controller=u'admin', action=u'register')}" title="register now">Register now!</a></span>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<input type="password" name="confirm-password" id="register-confirm-password" class="form-text" />
|
<input type="password" name="confirm-password" id="register-confirm-password" class="form-text" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<input type="submit" name="action" value="Register"/>
|
<input type="submit" name="action" value="Register" class="form-button" />
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
Reference in New Issue
Block a user