Commit 417a5a56 authored by Daniel W Bond's avatar Daniel W Bond

merge with social_docs branch, fixed student method reference

parents 181ef69d 36491a6f
......@@ -122,7 +122,7 @@ Then run `python manage.py migrate` to execute that sql code and set up your dat
Finally, run `python manage.py createsuperuser` to create an admin account, using the same username and email as you'll access through CAS. This means your 'full' email address, for instance gmason@masonlive.gmu.edu. Your password will be handled through CAS, so you can just use 'password' here.
(If you accidentally skip this step, you can run `python manage.py shell` and edit your user from there.)
(If you accidentally skip this step, you can run `python manage.py shell` and edit your user from there. Selectyour user, and set .is_staff and .is_superuser to True, then save.)
## Loading in demo data
......@@ -142,17 +142,75 @@ Head over to localhost:8000 and see the site!
## Configuring the Social Media Applications
Head over to localhost:8000/admin. Under 'Social Accounts', click on 'Social Applications'. Click 'Add social application' in the upper right hand corner. Start off by adding Facebook.
Social media authentication is provided through a package called [django-allauth](http://django-allauth.readthedocs.org/en/stable/installation.html). You can refer to those documentation pages for more information. Though in too many cases, the documenation is annoyingly sparse. The gulf between power of the package as shown through diving into the source and reading the documentation is vast.
To generate the name, id, key, and site for Facebook, you'll need to become a Facebook Developer and create a name.
What we're trying to accomplish with social media authentication is to verify users are linking to accounts they actually control. If we trusted users sufficiently to not type in gibberish or link to twitter.com/realDonaldTrump, we could provide a character field for each site.
Let's add localhost to our Available sites.
Head over to localhost:8000/admin. Under 'Social Accounts', click on 'Social Applications'. Click 'Add social application' in the upper right hand corner. We're going to start off by adding Facebook.
Now, to Instagram.
### Facebook
Next, to Twitter.
To fill in the name, id, key, and site for Facebook, (and for all of the social media sites), you'll need to become a Developer for the site in question.
Finally, to Google.
Navigate to, for example, the Facebook web login [documentation page](https://developers.facebook.com/docs/facebook-login/web). On the toolbar across the top of the page, you'll see a tab called 'My Apps'. Hovering over it, you'll see the option to Register as a Developer. Click the link, accept the Facebook platform and privacy policies, and you'll be ready to go. Depending on how fleshed out your profile page is, you may be prompted for more information (such as a phone number).
On the page you'll be [redirected to](https://developers.facebook.com/quickstarts/), select the website option. You'll be prompted to type the name of your new app. Because Facebook does not require apps to have globally unique names, go with something simple, like 'roomlist'. A dropdown will show an option to create a new app. Put Education as the category. Click on 'Create App ID'. If you see an option for 'namespace', skip over that for now: that's used for specifically defining the app's name via Facebook's API. For the line labeled 'Site URL', type 'localhost:8000'. Hit 'next' and then click the link on the section that lists functionality that says 'Skip to Developer Dashboard'. (For the record, we're implementing the Login functionality.)
You may be prompted to complete a captcha, and you'll then be shown your app's dashboard. The two things you need on roomlist are right up at the top, the App ID and the App Secret.
The user interface might be a bit different, particularly if you've done development with Facebook before, and some of these fields you may need to add after you've created the app. You may need to click 'Add Platform' from the Settings page of your app's Dashboard instead.
Back on the Django admin page, start filling in fields. App Name to Name, App ID to Client id, App Secret to Secret Key. The 'Sites' section is a security measure to ensure your app is only called from the urls you expect, and is what you put in for the 'Site URL' for the Facebook configuration.
Under 'Available Sites', click the little green plus button and add a new site. The Domain Name will be '127.0.0.1' and the Display Name 'localhost'. By default, Django has already gone to the trouble of creating 'example.com' as a site. Move example.com back to available sites and make sure 127.0.0.1 is added to Chosen Sites.
By default, example.com is the first site. We'll add our site id, localhost. In settings.py, this is already accounted for; the default there is SITE_ID = 2.
Let's add localhost to our Available sites, and then hit save.
Something you'll need to carefully specify is the callback (or redirect) url. This is where your user is sent once they have successfully authenticated with the outside social media site.
### Instagram
Instagram actually asks you what you want to build and then will choose to give you access or not. Cross your fingers and let's begin the process.
Sign up as developer on Instagram's [developer site](https://www.instagram.com/developer). Click on 'register your application'. You'll be asked a couple things. For your website, use localhost:8000. If your Instagram account does not have a phone number, you'll be asked to provide it here. Finally, for what you want to build with the API, write something along the lines of 'Verify users are linking to social media accounts they in fact control.' Accept the terms and sign up.
Interestingly, you'll be redirected to the 'Register Your Application' page. Click on 'Register Your Application' once more. From the next page, 'Manage clients', click 'Register a New Client ID'. On this form, for your Application name, you can also be generic; this does not need to be globally unique. For the description, you can use the same signup description you used initially. All fields except privacy policy are required, so use 'SRCT' as the company name. The website url will be http://localhost:8000. The 'http://' is required. For the valid redirect URI, Instagram takes a different tact than the other oauth2 applications. You will need the full redirect path. Type http://localhost:8000/accounts/instagram/login/callback/. The trailing slash is for some reason important. Because you can support multiple URIs, then hit tab. Use a real contact email. The privacy policy is not required. Complete the captcha and hit 'Register'.
Now add this information back into the Django admin. Create a new social application, and copy the client name to name, the client id to client id, and client secret to secret key. Make sure localhost is chosen as your site, and hit save.
### Twitter
Create a new social application, selecting Twitter as the provider.
Head to the Twitter [developer's page](https://dev.twitter.com/). Sign in, and go to apps.twitter.com and click 'create a new app'. Twitter does not require you to register as a developer up front, there is merely an agreement at the bottom on the new app page. You will, however, be required to add and verify your phone number to your Twitter account profile before submitting any apps.
Unlike the previous two sites, your app name must actually be globally unique. Pick, for example, 'roomlist-1234'. Next, your description will actually be shown to users when they sign in, so make sure it's reasonably coherent. Write something like 'verify your twitter account for roomlist'. For the website, use http://127.0.0.1:8000/. Use the same address for the callback, http://127.0.0.1:8000/. Agree to the developer terms, and click 'create your application'.
Next, by default, Twitter gives you more permissions than you actually need. On the app's page. click to the 'Permissions' tab. As we do not need to write to the users' Twitter account pages, select 'Read Only', and update your settings.
Now, click to the tab 'Keys and Access Tokens', and copy the 'Consumer Key' to Client ID on your new social application, and the 'Consumer Secret' to Secret Key. Make sure the name is the unique one you gave your app. Set localhost as your Site, and click Save.
### Google
Google's auth setup process is unquestionably the most confusing of the bunch, and yet we proceed, despite the ceiling of students who will link their Google+ page being approximately four.
Verify you have your phone number associated with your Google account, and then head to Google's [developer page](https://developers.google.com/). On that page, click 'Web'. Under the column titled 'Develop', click 'Sign In', and then click 'Get Started'.
The first step, will link you to the Google Developer's console. Click that link, then, intuitively (/s) click 'Select a Project' in the navbar, and then 'Create a Project' in the dropdown.
Type 'roomlist' in the project name field. Google will give you a globally unique project name underneath the field. Agree to the terms, and click 'create'.
Project name-- google gives you the project name
Go now to 'enable and manage APIs'. On the new screen under 'social APIs', click Google+ API. Click 'enable API', and then on the sidebar click 'credentials'. Then click 'add credentials', and 'oauth2 client id' under the dropdown. You will be asked to first configure a user consent screen (similar to the description we wrote for the Twitter client's authentication page). The only required field is your project name. Save, and then on the screen 'create client ID', click 'web application'. Name your project roomlist (this is only for your piece of mind, the actual name you'll use for Django is still the one Google generated for you), the authorized javascript origin is http://127.0.0.1:8000, without the trailing slash. For the authorized redirect url, type the full path like with Instagram, but inexplicably use 'localhost': http://localhost:8000/accounts/google/login/callback/, and *with* the trailing slash. Click 'Create'.
Copy the Client ID and Client Secret from the popup window that you'll then see into the Django social app's Client ID and Secret Key, respectively. Unless you delete the preceeding and trailing space when you copy the hashes, you will be sad because your string will be wrong.
If you've forgotten the name with the number, back on Google's page it's in the navbar, if you click on the more human-readable app's name.
Add localhost as the site, click save, and throw a party, because thank goodness, you're finally all set.
### Notes on Cacheing
......
......@@ -2,7 +2,7 @@ Django==1.7.3
Whoosh==2.6.0
argparse==1.2.1
beautifulsoup4==4.3.2
django-allauth==0.19.0
django-allauth==0.20.0
django-analytical==0.19.0
django-autoslug==1.7.2
django-braces==1.4.0
......
......@@ -2,19 +2,60 @@
from __future__ import absolute_import, print_function
from datetime import datetime, timedelta
# core django imports
from django.shortcuts import resolve_url
from django.core.urlresolvers import reverse
from django.views.generic import FormView
# third party imports
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from allauth.socialaccount.views import ConnectionsView
from allauth.socialaccount.forms import DisconnectForm
from braces.views import LoginRequiredMixin
class AccountAdapter(DefaultSocialAccountAdapter):
class AccountAdapter(DefaultAccountAdapter):
# the request processed by the adapter is one from the successful oauth callback
def get_login_redirect_url(self, request):
threshold = 90 # seconds
#def pre_social_login(self, request, sociallogin):
#print(request.get_full_path(), 'pre_login')
def populate_user(self, request, sociallogin, data):
# we don't actually want to overwrite anything from the
# social media account user
user = sociallogin.user
return user
def get_connect_redirect_url(self, request, socialaccount):
# where the user is sent if the social account is indeed authenticated
assert request.user.is_authenticated()
if ((request.user.last_login - request.user.date_joined).seconds < threshold):
url = '/accounts/student/'
#print(request.get_full_path())
#if 'welcome' in request.get_full_path():
# ergo, we go with more of an approximation (at least for now)
if not request.user.student.completedSocial:
return reverse('welcomeSocial', kwargs={
'slug': request.user.username,
})
else:
url = '/accounts/student/'
return resolve_url(url)
return reverse('updateStudent', kwargs={
'slug': request.user.username,
})
class RemoveSocialConfirmationView(LoginRequiredMixin, ConnectionsView):
template_name = "remove_social.html"
login_url = 'login'
def get(self, request, *args, **kwargs):
if not request.user.socialaccount_set.all():
# no social media accounts? back to the settings page with you!
return reverse('updateStudent',
kwargs={'slug':self.request.user.username})
else:
return super(RemoveSocialConfirmationView, self).get(request, *args, **kwargs)
def form_valid(self, form):
return super(RemoveSocialConfirmationView, self).form_valid(form)
def get_success_url(self):
return reverse('updateStudent',
kwargs={'slug':self.request.user.username})
......@@ -9,6 +9,7 @@ from model_utils.models import TimeStampedModel
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.utils.text import slugify
from django.contrib import messages
# third party imports
from autoslug import AutoSlugField
from randomslugfield import RandomSlugField
......@@ -201,12 +202,12 @@ class Student(TimeStampedModel):
def profile_image_url(self):
fb_uid = SocialAccount.objects.filter(user=self.user.id, provider='facebook')
print("profile_image")
#print("profile_image")
if len(fb_uid) > 0:
return "http://graph.facebook.com/{}/picture?width=175&height=175".format(fb_uid[0].uid)
return "http://www.gravatar.com/avatar/{}?s=175".format(hashlib.md5(self.user.email).hexdigest())
return "http://www.gravatar.com/avatar/{}?s=175&d=mm".format(hashlib.md5(self.user.email).hexdigest())
def get_absolute_url(self):
return reverse('detail_student', kwargs={'slug': self.slug})
......@@ -217,21 +218,21 @@ class Student(TimeStampedModel):
def get_first_name_or_uname(self):
if not(self.user.get_short_name()):
return self.user.get_username()
return self.user.username
else:
return self.user.get_short_name()
def get_last_name_or_uname(self):
if not(self.user.last_name):
return self.user.get_username()
return self.user.username
else:
return self.user.last_name
def get_full_name_or_uname(self):
if not(self.user.get_full_name_or_uname()):
return self.user.get_username()
if not(self.user.get_full_name()):
return self.user.username
else:
return self.user.get_full_name_or_uname()
return self.user.get_full_name()
class Meta:
ordering = ['user']
......
{% extends 'layouts/base.html' %}
{% block title %} SRCT RoomList | Flag {{ student.user.get_full_name_or_uname }} {% endblock %}
{% block title %} SRCT RoomList | Flag {{ student.get_full_name_or_uname }} {% endblock %}
{% block message_queue %}
{% endblock %}
......@@ -14,11 +14,7 @@
<p class="lead text-center">
<i class="fa fa-flag fa-lg"></i>
<strong>
{% if not student.user.get_full_name_or_uname %}
Someone
{% else %}
{{ student.user.get_full_name_or_uname }}
{% endif %}
{{ student.get_full_name_or_uname }}
</strong>
<em>is in the wrong room!</em>
</div>
......
{% extends 'layouts/base.html' %}
{% block title %} SRCT RoomList | Remove Flag {{ confirmation.student.user.get_full_name_or_uname }} {% endblock %}
{% block title %} SRCT RoomList | Remove Flag {{ confirmation.student.get_full_name_or_uname }} {% endblock %}
{% block message_queue %}
{% endblock %}
......@@ -15,11 +15,7 @@
<i class="fa fa-flag fa-lg"></i>
Maybe
<strong>
{% if not confirmation.student.user.get_full_name_or_uname %}
Someone
{% else %}
{{ confirmation.student.user.get_full_name_or_uname }}
{% endif %}
{{ confirmation.student.get_first_name_or_uname }}
</strong>
<em>is in the correct room after all...</em>
</div>
......
......@@ -6,15 +6,15 @@
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-2 col-md-offset-1 text-center">
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 175 %}" alt="{{ student.user.first_name }} Gravatar picture">
<img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_full_name_or_uname }} profile picture">
</div>
<div class="col-md-6 text-center">
<h1><strong>{{ student.user.get_full_name_or_uname }}</strong></h1>
<h1><strong>{{ student.get_full_name_or_uname }}</strong></h1>
{% if shares %}
<p class="lead"><strong>
{% if student.room == None %}
{{ student.user.first_name }} hasn't set their room yet.
{{ student.get_first_name_or_uname }} hasn't set their room yet.
{% else %}
<a href="{{ student.room.get_absolute_url }}">{{ student.room }}</a>
{% if same_floor %}
......@@ -103,7 +103,7 @@
<h4><i class="fa fa-facebook fa-lg"></i></h4>
</td>
<td class="col-md-8">
{% if accounts.facebook %} <h4><a href="http://www.facebook.com/{{ accounts.facebook.0.uid }}" target="_blank">Facebook</a></h4> {% else %} <h4>&mdash;</h4> {% endif %}
{% if accounts.facebook %} <h4><a href="https://facebook.com/{{ accounts.facebook.0.uid }}" target="_blank">Facebook account</a></h4> {% else %} <h4>&mdash;</h4> {% endif %}
</td>
</tr>
......@@ -111,7 +111,7 @@
<td>
<h4><i class="fa fa-google fa-lg"></i></h4>
</td>
<td>{% if accounts.google %} <h4><a href="https://plus.google.com/{{ accounts.google.0.uid }}" target="_blank">Google+</a></h4> {% else %} <h4>&mdash;</h4> {% endif %}
<td>{% if accounts.google %} <h4><a href="https://plus.google.com/{{ accounts.google.0.uid }}" target="_blank">Google+ account</a></h4> {% else %} <h4>&mdash;</h4> {% endif %}
</td>
</tr>
......@@ -120,7 +120,7 @@
<h4><i class="fa fa-twitter fa-lg"></i></h4>
</td>
<td>
{% if accounts.twitter %} <h4><a href="https://twitter.com/intent/user?user_id={{ accounts.twitter.0.uid }}" target="_blank">Twitter</a></h4> {% else %} <h4>&mdash;</h4> {% endif %}
{% if accounts.twitter %} <h4><a href="https://twitter.com/{{ accounts.twitter.0.extra_data.screen_name }}" target="_blank">@{{ accounts.twitter.0.extra_data.screen_name }}</a></h4> {% else %} <h4>&mdash;</h4> {% endif %}
</td>
</tr>
......@@ -129,7 +129,7 @@
<h4><i class="fa fa-instagram fa-lg"></i></h4>
</td>
<td>
{% if accounts.instagram %} <h4><a href="https://instagram/{{ accounts.instagram.0.uid }}" target="_blank">Instagram</a></h4> {% else %} <h4>&mdash;</h4> {% endif %}
{% if accounts.instagram %} <h4><a href="https://instagram.com/{{ accounts.instagram.0.extra_data.username }}" target="_blank">@{{ accounts.instagram.0.extra_data.username }}</a></h4> {% else %} <h4>&mdash;</h4> {% endif %}
</td>
</tr>
</tbody>
......
......@@ -27,7 +27,7 @@
<div class="row">
{% for student in building.list %}
<div class="col-sm-3 text-center">
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.get_first_name_or_uname }} Gravatar picture">
<img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_first_name_or_uname }} profile picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
{% if student.get_flag_count > 4 %}
<p><em>* a number of other floormates say this info is incorrect</em></p>
......@@ -53,8 +53,8 @@
<div class="row">
{% for student in building.list %}
<div class="col-sm-3 text-center">
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.user.first_name }} {{ student.user.last_name }}</strong></a></h4>
<img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_first_name_or_uname }} profile picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
{% if student.get_flag_count > 4 %}
<p><em>* a number of other floormates say this info is incorrect</em></p>
{% endif %}
......@@ -79,8 +79,8 @@
<div class="row">
{% for student in building.list %}
<div class="col-sm-3 text-center">
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.user.first_name }} {{ student.user.last_name }}</strong></a></h4>
<img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_first_name_or_uname }} profile picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
{% if student.get_flag_count > 4 %}
<p><em>* a number of other floormates say this info is incorrect</em></p>
{% endif %}
......@@ -101,8 +101,8 @@
<div class="col-md-12">
{% for student in location_hidden %}
<div class="col-sm-3 text-center">
<img class="img-circle img-responsive center center-block" src="{% gravatar_url student.user.email 100 %}" alt="{{ student.user.first_name }} Gravatar picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.user.first_name }} {{ student.user.last_name }}</strong></a></h4>
<img class="img-circle img-responsive center center-block" src="{{ student.profile_image_url }}" alt="{{ student.get_first_name_or_uname }} profile picture">
<h4><a href="{{ student.get_absolute_url }}"><strong>{{ student.get_full_name_or_uname }}</strong></a></h4>
</div>
{% endfor %}
</div>
......
{% extends 'layouts/base.html' %}
{% block title %} SRCT RoomList | Remove Social Accounts {% endblock %}
{% block message_queue %}
{% endblock %}
{% block content %}
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12 text-center">
<h1><strong>SRCT</strong>&#8203;ROOMLIST</h1>
<p class="lead text-center">Remove My Social Media Accounts</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title text-center"><strong>Connected Social Media Accounts</strong></h1>
</div>
<div class="panel-body">
<form class="form-horizontal text-center" method="post" action="">{% csrf_token %}
<fieldset>
{% if form.non_field_errors %}
<div id="errorMsg">{{ form.non_field_errors }}</div>
{% endif %}
{% for base_account in form.accounts %}
{% with base_account.get_provider_account as account %}
<div>
<p><label for="id_account_{{ base_account.id }}" style="font-size:20px">
<input id="id_account_{{ base_account.id }}" type="radio" name="account" value="{{ base_account.id }}"/>
<span class="socialaccount_provider {{ base_account.provider }} {{ account.get_brand.id }}">
<i class="fa fa-{{base_account.provider}} fa-lg fa-fw"></i>
{{account.get_brand.name}}
</span>
<small><em>{{ account }}</em></small>
</label></p>
</div>
{% endwith %}
{% endfor %}
<div>
<input type="submit" value="Remove" class="btn btn-danger"/>
<input type="cancel" value="Never Mind" class="btn btn-default" onclick="history.back()"/>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2 text-center">
<div class="alert alert-danger" role="alert">
<p><i class="fa fa-exclamation-circle fa-fw fa-lg"></i> While this form will
immediately delete your account from our database, it may still exist for
a time on the related social media account's database. Check that social media
profile's authorized apps page for more information.</p>
</div>
</div>
</div>
{% endblock %}
......@@ -45,7 +45,7 @@ SRCT Roomlist &bull; Search Students
<h4>{{ result.object.user.username }}</h4>
</td>
<td>
<a href="{{ result.object.get_absolute_url }}"><h4><strong>{{ result.object.user.get_full_name_or_uname }}</strong></h4></a>
<a href="{{ result.object.get_absolute_url }}"><h4><strong>{{ result.object.get_full_name_or_uname }}</strong></h4></a>
</td>
<td>
{% if result.object.major %}
......
{% extends 'layouts/base.html' %}
{% block title %} SRCT Roomlist | Student | Update {% endblock %}
{% block title %} SRCT Roomlist | Student | {{ request.user.student.get_full_name_or_uname }} | Update {% endblock %}
{% block message_queue %}
{% endblock %}
......@@ -9,6 +9,8 @@
{% include 'room_change_warning.html' %}
{% include 'messages.html' %}
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12 text-center">
......@@ -19,7 +21,7 @@
<div class="row">
<div class="col-md-12 text-center">
<h2><strong>Welcome, {{ me.get_first_name_or_uname }}!</strong></h2>
<h2><strong>Welcome, {{ request.user.student.get_first_name_or_uname }}!</strong></h2>
</div>
</div>
......@@ -27,6 +29,8 @@
{% load socialaccount %} {% providers_media_js %}
{% get_social_accounts request.user as accounts %}
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
......@@ -38,21 +42,27 @@
<div class="row text-center">
<div class="col-md-6">
{% if accounts.facebook %}
<p><i class="fa fa-check-square-o"></i> Verified!</p>
{% endif %}
<a href="{% provider_login_url 'facebook' method='js_sdk' process='connect' next='#' %}">
<p><i class="fa fa-check-square-o"></i> Verified!</p>
<h4><i class="fa fa-facebook fa-2x"></i></h4>
<h4>Facebook</h4>
{% else %}
<a href="{% provider_login_url 'facebook' process='connect' %}">
<h4><i class="fa fa-facebook fa-2x"></i></h4>
<h4>Facebook</h4>
</a>
{% endif %}
</div>
<div class="col-md-6">
{% if accounts.google %}
<p><i class="fa fa-check-square-o"></i> Verified!</p>
{% endif %}
<a href="{% provider_login_url 'google' method='js_sdk' process='connect' next='#' %}">
<h4><i class="fa fa-google fa-2x"></i></h4>
<h4>Google</h4>
{% else %}
<a href="{% provider_login_url 'google' process='connect' %}">
<h4><i class="fa fa-google fa-2x"></i></h4>
<h4>Google</h4>
</a>
{% endif %}
</div>
</div>
<br />
......@@ -60,22 +70,65 @@
<div class="col-md-6">
{% if accounts.twitter %}
<p><i class="fa fa-check-square-o"></i> Verified!</p>
{% endif %}
<a href="{% provider_login_url 'twitter' method='js_sdk' process='connect' next='#' %}">
<h4><i class="fa fa-twitter fa-2x"></i></h4>
<h4>Twitter</h4>
{% else %}
<a href="{% provider_login_url 'twitter' process='connect' %}">
<h4><i class="fa fa-twitter fa-2x"></i></h4>
<h4>Twitter</h4>
</a>
{% endif %}
</div>
<div class="col-md-6">
{% if accounts.instagram %}
<p><i class="fa fa-check-square-o"></i> Verified!</p>
{% endif %}
<a href="{% provider_login_url 'instagram' method='js_sdk' process='connect' next='#' %}">
<h4><i class="fa fa-instagram fa-2x"></i></h4>
<h4>Instagram</h4>
{% else %}
<a href="{% provider_login_url 'instagram' process='connect' %}">
<h4><i class="fa fa-instagram fa-2x"></i></h4>
<h4>Instagram</h4>
</a>
{% endif %}
</div>
</div>
{% comment %}
<br />
<div class="row text-center">
<div class="col-md-6">
{% if accounts.tumblr %}
<p><i class="fa fa-check-square-o"></i> Verified!</p>
<h4><i class="fa fa-tumblr fa-2x"></i></h4>
<h4>Tumblr</h4>
{% else %}
<a href="{% provider_login_url 'tumblr' process='connect' %}">
<h4><i class="fa fa-tumblr fa-2x"></i></h4>
<h4>Tumblr</h4>
</a>
{% endif %}
</div>
<div class="col-md-6">
{% if accounts.github %}
<p><i class="fa fa-check-square-o"></i> Verified!</p>
<h4><i class="fa fa-github fa-2x"></i></h4>
<h4>Github</h4>
{% else %}
<a href="{% provider_login_url 'github' process='connect' %}">
<h4><i class="fa fa-github fa-2x"></i></h4>
<h4>Github</h4>
</a>
{% endif %}
</div>
</div>
{% endcomment %}
<br />
{% if accounts %}
<div class="row text-center">
<a href="{% url 'remove_social' request.user.username %}">
<button class="btn btn-xs btn-danger">Disconnect Accounts</button>
</a>
</div>
{% endif %}
</div>
</div>
</div>
......
......@@ -23,7 +23,7 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<p class="text-center">Now let's verify your major. This lets others find you and others with their same major, which, for example, makes it easier to form study groups.</p>
<p class="text-center">Now let's verify your major, {{ request.user.student.get_first_name_or_uname }}. This lets others find you and others with their same major, which, for example, makes it easier to form study groups.</p>
<p class="text-center">Then, add what year you expect you'll graduate.</p>
</div>
</div>
......
......@@ -25,7 +25,7 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<p class="text-center">Great! Now to your housing information and settings. Here, you'll select which room you live in, and then choose who you want to be able to see that information.</p>
<p class="text-center">Great, {{ request.user.student.get_first_name_or_uname }}! Now to your housing information and settings. Here, you'll select which room you live in, and then choose who you want to be able to see that information.</p>
<p class="text-center"><strong>By default, your privacy is set to 'Floor'.</strong> That means only other students living on your floor can see your room.</p>
<p class="text-center">You can choose to set your privacy to 'Building', which will make your room visible to everyone living in your building, or to 'Campus', where it will be visible to anyone with a current Mason username and password.</p>
</div>
......
......@@ -24,12 +24,15 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<p class="text-center">We're not trying to recreate Facebook here. On this final step, you can point people to a variety of your social media accounts from your user page.</p>
<p class="text-center">You'll be asked to sign in, but that's just to verify the account actually belongs to you. With the exception of your choice to use your Facebook profile picture as your profile picture here, we don't see or use any information on these third-party sites.</p>
<p class="text-center">You'll be asked to sign in, but that's just to verify the account actually belongs to you. With the exception of your choice to use your Facebook profile picture as your profile picture here, we don't use any information on these third-party sites.</p>
<p class="text-center">We'll only show these links to people who can also see your room.</p>
</div>
</div>
{% load socialaccount %} {% providers_media_js %}
{% get_social_accounts request.user as accounts %}