Update settings and Fix User Activation
Updated some of the values in settings.py and fixed user activation email template. Change-Id: I1eb60b624ad5d6516b7750ddbb90dc0d5087e62a
This commit is contained in:
parent
4b7320e634
commit
284c955ec6
@ -8,5 +8,6 @@ urlpatterns = [
|
||||
url(r'^login/$', auth_views.login, {'template_name': 'authcp/login.html'}, name='login'),
|
||||
url(r'^logout/$', auth_views.logout, name='logout'),
|
||||
url(r'^register/$', views.register_user, name='register'),
|
||||
url(r'^register-activate/(?P<key>.+)$', views.activation, name='register-activate'),
|
||||
url(r'^register-success/$', views.register_success, name='register-success'),
|
||||
]
|
||||
|
@ -1,6 +1,7 @@
|
||||
import random, hashlib, datetime
|
||||
import random, hashlib
|
||||
|
||||
from oslo_i18n import translate as _
|
||||
from datetime import timedelta
|
||||
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import HttpResponseRedirect
|
||||
@ -45,17 +46,17 @@ def register_user(request):
|
||||
usernamesalt=form.cleaned_data['email']
|
||||
profile=Profile.objects.get(user_id=u.id)
|
||||
profile.activation_key=hashlib.sha1(salt+usernamesalt).hexdigest()
|
||||
profile.key_expires=datetime.datetime.strftime(datetime.datetime.now() + datetime.timedelta(days=2),
|
||||
"%Y-%m-%d %H:%M:%S")
|
||||
profile.key_expires=timezone.now() + timedelta(days=2)
|
||||
profile.save()
|
||||
send_email({'u': u, 'profil': profile},
|
||||
site_url=settings.SITE_ROOT_URL
|
||||
send_email({'u': u, 'profile': profile, 'site_url': site_url},
|
||||
_('Welcome to our cloud'),
|
||||
u.email,
|
||||
settings.DEFAULT_EMAIL_FROM,
|
||||
)
|
||||
return render(request,
|
||||
'authcp/success.html',
|
||||
{'u': u, 'profil': profile})
|
||||
{'u': u, 'profile': profile})
|
||||
else:
|
||||
print(form.errors)
|
||||
else:
|
||||
|
@ -32,7 +32,7 @@ ALLOWED_HOSTS = [
|
||||
]
|
||||
|
||||
# fullt qualified hostname or domain. Ex <http://domain.tld/>
|
||||
SITE_ROOT_URL = 'http://demo.dash-stack.com/'
|
||||
SITE_ROOT_URL = 'http://127.0.0.1:8000'
|
||||
|
||||
# login url
|
||||
LOGIN_URL = '/auth/login/'
|
||||
@ -116,6 +116,10 @@ DATABASES = {
|
||||
'PASSWORD': 'password',
|
||||
'HOST': 'localhost',
|
||||
'PORT': '',
|
||||
'OPTIONS': {
|
||||
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
|
||||
'init_command': 'SET innodb_strict_mode=1',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,8 +144,6 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
@ -154,8 +156,6 @@ USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/1.10/howto/static-files/
|
||||
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, "static"),
|
||||
]
|
||||
@ -169,10 +169,10 @@ STATIC_URL = '/static/'
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
|
||||
# Host for sending e-mail.
|
||||
EMAIL_HOST = 'localhost'
|
||||
EMAIL_HOST = '35.156.60.241'
|
||||
|
||||
# Port for sending e-mail.
|
||||
EMAIL_PORT = 25
|
||||
EMAIL_PORT = 587
|
||||
|
||||
# Optional SMTP authentication information for EMAIL_HOST.
|
||||
EMAIL_HOST_USER = ''
|
||||
|
@ -3,4 +3,5 @@ Django==1.10.3
|
||||
mysqlclient==1.3.9
|
||||
oslo.i18n==3.10.0
|
||||
requests==2.12.1
|
||||
django-settings-export==1.2.1
|
||||
django-settings-export==1.2.1
|
||||
pytz==2016.10
|
@ -7,10 +7,6 @@
|
||||
<div class="register-logo">
|
||||
<a href="/"><b> - </b>stack</a>
|
||||
</div>
|
||||
|
||||
{{ u.get_profile.activation_key }} <br>
|
||||
{{ profile }}
|
||||
|
||||
<div class="login-box-body">
|
||||
<p class="lead">
|
||||
Thank you for registering a new account with us.
|
||||
|
@ -11,7 +11,7 @@
|
||||
Please click on following link to activate your account:
|
||||
|
||||
<p>
|
||||
<a href="{{ settings.SITE_ROOT_URL }}{{ profile.activation_key }}">
|
||||
<a href="{{ site_url }}/auth/register-activate/{{ profile.activation_key }}">
|
||||
{{ profile.activation_key }}
|
||||
</a>
|
||||
</p>
|
||||
|
@ -2,5 +2,5 @@ Hello,
|
||||
|
||||
Welcome to our cloud platform.
|
||||
|
||||
Activare your email:
|
||||
Activate your email:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user