Example #1
0
	def post(self, user_id):
		args = teamParser.parse_args()
		profileID = args['profileID']

		profile = Profile.objects(id=profileID).first()
		request = Request.objects(user=user_id,type='invite').only('requests_list').first()
		if request is None or profile is None:
			raise InvalidUsage('Request is illegal')

		team = profile.LOLTeam

		success = request.update(pull__requests_list=profile)
		if success is 0 or team is None or team.captain != profile:
			raise InvalidUsage('Request is illegal') 

		profile = Profile.objects(user=user_id).first()
		if profile.LOLTeam is not None:
			raise InvalidUsage('Already joined a team')
		try:
			assert len(team.members) < 6
			team.members.append(profile)
		except:
			raise InvalidUsage('Team is full', 403)
		profile.LOLTeam = team

		team.save()
		profile.save()

		rongcloudJoinGroup(profile.id,team.id,teamName)

		return team_serialize(team)
Example #2
0
    def post(self):
        args = fbUserParser.parse_args()
        fb_id = args['fbid']
        fb_token = args['fbtoken']   
        if fb_id is None or fb_token is None:
           abort(400)

        fbuser_info = requests.get('https://graph.facebook.com/me?access_token=%s' %fb_token).json()
        if not fbuser_info.get('id') or fb_id != fbuser_info['id']:
            raise InvalidUsage('User info does not match',406)

        fb_email = args['fbemail']
        user = User.objects(email=fb_email).first()
        
        if user is None:
            user = User(email=fb_email, fb_id=fbuser_info['id'])
            user.save()
            
        profile = Profile.objects(user=user).first()
        if profile is None:
            profile = Profile(user=user)
            profile.save()

        rongToken = rongcloudToken(profile.id)
        token = user.generate_auth_token()
        redis_store.set(str(user.id), token)
        return {'token': token, 'rongToken' : rongToken}
def test_modify_contact_firstname(app):
    if app.profile.count() == 0:
        app.profile.create(Profile(firstname="test"))
    old_profiles = app.profile.get_contact_list()
    app.profile.modify_first_contact(Profile(firstname="Sfairat"))
    new_profiles = app.profile.get_contact_list()
    assert len(old_profiles) == len(new_profiles)
Example #4
0
    def post(self, user_id):
        """
        Add a specific user to friend list, and
        send a friend request to that user
        """
        args = friendsParser.parse_args()
        profile_id = args['profile_id']

        if profile_id is None:
            abort(400)

        friend_profile = Profile.objects(id=profile_id).only('user').first()
        if friend_profile is None:
            abort(400)

        # add the user to friend list
        success = Friend.objects(user=user_id).only(
            'friends_list').update_one(add_to_set__friends_list=profile_id)
        if success is 0:
            friends = Friend(user=user_id, friends_list=[profile_id])
            friends.save()

        # put the friend request to the user's request list
        user_profile = Profile.objects(user=user_id).only('id').first()
        success = Request.objects(user=friend_profile.user).update_one(
            add_to_set__requests_list=user_profile)
        if success is 0:
            friend_request = Request(
                user=friend_profile.user,
                type='friends', requests_list=[user_profile])
            friend_request.save()

        return {'status': 'success', 'message':
                'The user has been added to your friend list'}
Example #5
0
	def delete(self, user_id):
		args = teamParser.parse_args()
		profileID = args['profileID']
		profile = Profile.objects(user=user_id).first()
		team = profile.LOLTeam
		# avoid illegal operation
		if team is None:
			abort(400)
		if team.captain != profile:
			raise InvalidUsage('Unauthorized',401)
		# query the player u want to kick
		member = Profile.objects(id=profileID).first()
		if member == profile:
			raise InvalidUsage('Cannot kick yourself')

		success = team.update(pull__members=member)
		if success is 0:
			raise InvalidUsage('Member not found')
		
		member.LOLTeam = None
		team.save()
		member.save()

		rongcloudLeaveGroup(member.id,team.id)
		
		return {'status' : 'success'}
Example #6
0
    def post(self, user_id):
        """
        Upload user's profile icon
        """
        uploaded_file = request.files['upload']
        filename = "_".join([user_id, uploaded_file.filename])

        # upload the file to S3 server
        conn = boto.connect_s3(os.environ['S3_KEY'], os.environ['S3_SECRET'])
        bucket = conn.get_bucket('profile-icon')
        key = bucket.new_key(filename)
        key.set_contents_from_file(uploaded_file)

        # update the user's profile document
        profile = Profile.objects(user=user_id).first()
        if profile is None:
            profile = Profile(
                user=user_id,
                profile_icon=
                'https://s3-us-west-2.amazonaws.com/profile-icon/%s' %
                filename)
            profile.save()
        else:
            profile.profile_icon = 'https://s3-us-west-2.amazonaws.com/profile-icon/%s' % filename
            profile.save()

        return serialize(profile)
Example #7
0
    def post(self):
        args = userParser.parse_args()
        email = args['email']
        password = args['password']
        if email is None or password is None:
            abort(400)    

        user = User(email=email)
        user.hash_password(password)
        profile = Profile(user=user)
        try:
            user.save()
            profile.save()
        except ValidationError, e:
            raise InvalidUsage(e.message)  
    def post(self):
        """
        Verify the information from user
        Send a reset password email if the information is correct
        """
        args = forgetPasswordParser.parse_args()
        email = args['email']
        username = args['username']
        school = args['school']

        if email is None or username is None or school is None:
            abort(400)

        user = User.objects(email=email).first()
        if user is None:
            return {'status': 'error', 'message':
                    'There is no user associated with the email'}

        profile = Profile.objects(user=user).first()
        if not profile.checkInfo(username, school):
            return {'status': 'error', 'message':
                    'The information does not match the record'}

        token = user.generate_auth_token(expiration=360000)
        send_forget_password_email(email, token)

        return {'status': 'success', 'message':
                'An email has been sent to you letting you reset password'}
Example #9
0
    def post(self):
        """
        Verify the information from user
        Send a reset password email if the information is correct
        """
        args = forgetPasswordParser.parse_args()
        email = args['email']
        username = args['username']
        school = args['school']

        if email is None or username is None or school is None:
            abort(400)

        user = User.objects(email=email).first()
        if user is None:
            return {
                'status': 'error',
                'message': 'There is no user associated with the email'
            }

        profile = Profile.objects(user=user).first()
        if not profile.checkInfo(username, school):
            return {
                'status': 'error',
                'message': 'The information does not match the record'
            }

        token = user.generate_auth_token(expiration=360000)
        send_forget_password_email(email, token)

        return {
            'status': 'success',
            'message':
            'An email has been sent to you letting you reset password'
        }
Example #10
0
    def get(self, user_id):
        # load profile 
        profile =  Profile.objects(user=user_id).first()
        if profile is None:
        	return {}

        return serialize(profile)
Example #11
0
def init():
    handler = pugsql.module('assets/sql')
    handler.connect('sqlite:///memory')
    settings.sql = handler

    # Create table if they don't exist
    handler.org_create()
    handler.user_create()
    handler.prof_create()
    handler.fund_create()
    handler.stat_create()
    handler.value_create()
    handler.role_create()
    handler.role_user_create()

    # Add test rows if they don't exist
    org = handler.org_find(id=1)
    if (org == None):
        org = Organization.add('Test Company')
        admin = User.add('admin', 'test123')
        guest = User.add('guest', 'test123')
        admin_role = Role.add('admin')
        admin.add_to_role(role_id=admin_role.id)
        profile = Profile.add('Test Profile', org.id)
        fund = Fund.add('Test Fund', 'Test Manager', 2000, 0.00, 0.00,
                        profile.id)

    # return the queries handler
    return handler
Example #12
0
	def post(self, user_id):
		args = postParser.parse_args()
		content = args['content']

		profile = Profile.objects(user=user_id).first()
		post = PlayerPost(user_profile=profile, content=content)
		post.save()

		return {'status': 'success'}
Example #13
0
    def get(self, user_id):
        """
        Load the user's profile
        """
        profile = Profile.objects(user=user_id).first()
        if profile is None:
            return {}

        return serialize(profile)
Example #14
0
    def get(self, user_id):
        """
        Load the user's profile
        """
        profile = Profile.objects(user=user_id).first()
        if profile is None:
            return {}

        return serialize(profile)
Example #15
0
 def get_contact_list(self):
     if self.profile_cache is None:
         wd = self.app.wd
         self.profile_cache = []
         for element in wd.find_elements_by_name("entry"):
             text = element.text
             id = element.find_element_by_name("selected[]").get_attribute("value")
             self.profile_cache.append(Profile(firstname=text, id=id))
     return list(self.profile_cache)
Example #16
0
	def get(self, user_id):
		args = tournamentParser.parse_args()
		page = args['page']
		if page is None:
			page = 0

		profile = Profile.objects(user=user_id).first()
		tournaments = Tournament.objects(creator=profile).only('id','creator','isEnded','createTime','rounds','isFull')

		return tournament_search_serialize(tournaments[5*page:5*(page+1)])
Example #17
0
 async def profiles(cls):
     administrator = Profile({
         'username': '******',
         'password': '******',
         'email': '*****@*****.**',
         'name': {
             'first': 'administrator'
         }
     })
     await administrator.save()
Example #18
0
def app(request):
    global fixture
    global target
    if target is None:
        with open(request.config.getoption("--target")) as config_file:
            target = json.load(config_file)
    if fixture is None or not fixture.is_valid(
    ):  #если фикстура не проинициализировалась или невалидна
        fixture = Application()
    fixture.session.ensure_login(
        Profile(mobile=target['mobile'], password=target['password']))
    return fixture
Example #19
0
    def post(self, user_id):
        """
        Make a new post
        """
        args = postParser.parse_args()
        content = args['content']

        profile = Profile.objects(user=user_id).first()
        post = Post(user=user_id, user_profile=profile, content=content)
        post.save()

        return {'status': 'success'}
Example #20
0
class SettingController(BaseController):
  def before_action(self):
    self.user = users.get_current_user()
    if self.user == None:
      self.response.out.write("Bad Request")
      return;
      pass

    results = db.GqlQuery("SELECT * FROM Profile WHERE user = :1",self.user)
    self.profile = results.get()

  def index(self):
    if self.profile == None:
      self.profile = Profile(user=self.user)

  def edit(self):
    if self.profile == None:
      self.response.out.write("Bad Request")
      return;

  def update(self):
    if self.request.method.upper() != "POST":
      return

    if self.profile == None:
      self.profile = Profile(user=self.user)
    self.profile.organization = self.params.get('organization')
    self.profile.section = self.params.get('section')
    self.profile.last_name = self.params.get('last_name')
    self.profile.first_name = self.params.get('first_name')
    self.profile.last_name_hira = self.params.get('last_name_hira')
    self.profile.first_name_hira = self.params.get('first_name_hira')
    self.profile.email = self.params.get('email')
    self.profile.tel_no = self.params.get('tel_no')
    self.profile.zip_code = self.params.get('zip_code')
    self.profile.prefecture = self.params.get('prefecture')
    self.profile.city = self.params.get('city')
    self.profile.address = self.params.get('address')

    self.profile.put()
Example #21
0
    def renderFund(self, fund_id):
        fund = Fund.find(fund_id)
        profile = Profile.find(fund.prof)
        organization = Organization.find(profile.org)

        # these stats are inputs and show up in the top part of the page
        stats_beta = ['Beta']
        stats_controlled = ['Alpha', 'RM', 'RF']
        stats_curves = ['c_rate', 'd_rate']

        # these stats are calculated and show up after calc is clicked
        stats_calculated = [
            'growth_rate', 'NAV', 'Unfunded', 'Called', 'Distributed'
        ]

        stats = {}
        x = None
        for stat_name in stats_beta + stats_controlled + stats_curves + stats_calculated:
            stat = Stat.find_by_name(stat_name, fund_id, 'db')

            if not stat == None:
                stats[stat_name] = {
                    'y': stat.get_values()[1],
                    # 'color_line': stat.color_line,
                    # 'color_fill': stat.color_fill
                    'color_line': settings.colors[stat_name]['color_line'],
                    'color_fill': settings.colors[stat_name]['color_fill']
                }
                if x == None:
                    x = stat.get_values()[0]

            elif stat_name in stats_controlled + stats_beta + stats_curves:
                stats[stat_name] = {
                    'y': [1 for x in range(6)],
                    'color_line': settings.colors[stat_name]['color_line'],
                    'color_fill': settings.colors[stat_name]['color_fill']
                }
                if x == None:
                    x = [x for x in range(6)]

        return {
            'fund_name': fund.fund_name,
            'fund': fund_id,
            'prof_name': profile.prof_name,
            'org_name': organization.org_name,
            'x': x,
            'stats': stats,
            'stats_beta': stats_beta,
            'stats_curves': stats_curves,
            'stats_controlled': stats_controlled,
            'stats_calculated': stats_calculated
        }
Example #22
0
	def get(self, user_id):
		profile = Profile.objects(user=user_id).first()
		team = profile.LOLTeam
		if team is None:
			raise InvalidUsage('Team not found',404)
		if team.captain != profile:
			raise InvalidUsage('Unauthorized',401)
		if team.inGame is False:
			raise InvalidUsage('Not in a tournament')

		match = team.matchHistory[-1]

		return match_serialize(match)
Example #23
0
	def post(self, user_id):
		args = teamParser.parse_args()
		profileID = args['profileID']

		request = Request.objects(user=user_id, type='join').only('requests_list').first()
		if request is None:
			raise InvalidUsage('Request does not exist')

		captain = Profile.objects(user=user_id).first()
		team = captain.LOLTeam
		if team is None:
			raise InvalidUsage('Request is illegal')

		if team.captain != captain:
			raise InvalidUsage('Unauthorized',401)
		# query the player u want to invite
		profile = Profile.objects(id=profileID).first()
		success = request.update(pull__requests_list=profile)
		if success is 0:
			raise InvalidUsage('Request not found')

		if profile is None:
			raise InvalidUsage('Member not found',404)
		if profile.LOLTeam is not None:
			raise InvalidUsage('The user already joined a team')
		try:
			assert len(team.members) < 6
			team.members.append(profile)
		except:
			raise InvalidUsage('Team is full',403)
		profile.LOLTeam = team
		team.save()
		profile.save()

		rongcloudJoinGroup(profile.id,team.id,teamName)

		return team_serialize(team)
Example #24
0
    def __init__(self, docproxy, parent=None):
        super(AssignCMSDialog,
              self).__init__(_T("Assign Profile"), parent,
                             gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                             (gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL,
                              gtk.RESPONSE_CANCEL))

        self._bt = []
        self._current = docproxy.profile
        self._profiles = Profile.get_all()

        frame = gtk.Frame(_T("Assign Profile") + ':')
        self.vbox.pack_start(frame, False, False)

        vbox = gtk.VBox()
        frame.add(vbox)

        # Nothing
        bt1 = gtk.RadioButton(None, _T("No color management on this document"))
        self._bt.append(bt1)
        vbox.pack_start(bt1, False, False)

        # Current
        if docproxy.profile:
            bt2 = gtk.RadioButton(bt1,
                                  _T("Working") + ': %s' % docproxy.profile)
            bt2.set_active()
            self._bt.append(bt2)
            vbox.pack_start(bt2, False, False)
        else:
            self._bt.append(None)

        # New one
        bt3 = gtk.RadioButton(bt1, _T("Profile") + ': ')
        self._bt.append(bt3)

        cb = gtk.combo_box_new_text()
        for profile in self._profiles:
            cb.append_text(str(profile))
        cb.set_active(0)
        self._cb = cb

        hbox = gtk.HBox()
        hbox.pack_start(bt3, False, False)
        hbox.pack_start(cb)

        vbox.pack_start(hbox, False, False)

        self.show_all()
Example #25
0
	def post(self, user_id):
		profile = Profile.objects(user=user_id).first()
		team = profile.LOLTeam
		# prevent bad request
		if team.captain != profile:
			raise InvalidUsage('Unauthorized',401)
		uploaded_file = request.files['upload']
		filename = "_".join([user_id, uploaded_file.filename])
		conn = boto.connect_s3('AKIAJAQHGWIZDOAEQ65A', 'FpmnFv/jte9ral/iXHtL8cDUnuKXAgAqp9aXVQMI')
		bucket = conn.get_bucket('team-icon')
		key = bucket.new_key(filename)
		key.set_contents_from_file(uploaded_file)
		team.teamIcon = 'https://s3-us-west-2.amazonaws.com/team-icon/%s' %filename
		team.save()
		return team_serialize(team)
Example #26
0
    def post(self, user_id):
        """
        Edit the user's profile if the profile exists
        Otherwise, create a new profile document
        """
        args = profileParser.parse_args()
        username = args['username']
        school = args['school']
        intro = args['intro']

        profile = Profile.objects(user=user_id).first()
        if profile is None:
            profile = Profile(user=user_id,
                              username=username,
                              school=school,
                              intro=intro)
            profile.save()
        else:
            profile.username = username
            profile.school = school
            profile.intro = intro
            profile.save()

        return serialize(profile)
Example #27
0
	def post(self, user_id):
		args = profileParser.parse_args()
		tournamentId = args['tournamentId']

		profile = Profile.objects(user=user_id).first()
		if profile.LOLTeam is None:
			raise InvalidUsage()

		team = profile.LOLTeam
		if team.captain is not profile:
			raise InvalidUsage()

		challonge.participants.create(tournamentId,team.teamName)
		#rongcloudJoinGroup()
		return {'status' : 'success'}
Example #28
0
	def post(self, user_id):
		args = teamParser.parse_args()
		profileID = args['profileID']
		teamIntro = args['teamIntro']
	
		profile = Profile.objects(user=user_id).first()
		if profileID == profile.id:
			raise InvalidUsage('Cannot send request to yourself')

		team = profile.LOLTeam
		if profileID is None and teamIntro is not None:
			if team.captain is not profile:
				raise InvalidUsage('Unauthorized',401)
			team.teamIntro = teamIntro
			team.save()
			return {'status' : 'success'}
		# avoid illegal operation
		if team is None:
			abort(400)
		if team.captain != profile:
			raise InvalidUsage('Unauthorized',401)
		# query the player u want to invite
		profile = Profile.objects(id=profileID).first()
		if profile is None:
			raise InvalidUsage('Member not found',404)
		try:
			assert len(team.members) < 6
		except:
			raise InvalidUsage('Team is full',403)
		request = Request.objects(user=profile.user,type='invite').only('requests_list').first()
		if request is None:
			request = Request(user=profile.user,type='invite')
			request.save()
		request.update(add_to_set__requests_list=team.captain)

		return {'status' : 'success'}
Example #29
0
def rongRefresh(profile_id):
    profile = Profile.objects(id=profile_id).first()
    if profile is None:
        raise InvalidUsage("Wrong action",401)

    user = profile.user
    if user.rongToken is None:
        return rongcloudToken(profile_id)
    api.call_api(
            action="/user/refresh",
            params={
                "userId": profile_id,
                "name": profile.username,
                "portraitUri": profile.profile_icon
            }
        )
Example #30
0
	def post(self, user_id):
		profile = Profile.objects(user=user_id).first()
		if profile.LOLTeam is not None:
			raise InvalidUsage('Only one team per game allowed')
		args = teamParser.parse_args()
		teamName = args['teamName']
		teamIntro = args['teamIntro']
		isSchool = args['isSchool']
		school = args['school']
		team = LOLTeam(teamName=teamName,teamIntro=teamIntro,captain=profile,isSchool=isSchool)
		if isSchool is True:
			team.school = school
		try:
			team.save()
		except ValidationError, e:
			raise InvalidUsage(e.message)  
Example #31
0
    def post(self, user_id):
        """
        Edit the user's profile if the profile exists
        Otherwise, create a new profile document
        """
        args = profileParser.parse_args()
        username = args['username']
        school = args['school']
        intro = args['intro']

        profile = Profile.objects(user=user_id).first()
        if profile is None:
            profile = Profile(
                user=user_id, username=username, school=school, intro=intro)
            profile.save()
        else:
            profile.username = username
            profile.school = school
            profile.intro = intro
            profile.save()

        return serialize(profile)
Example #32
0
	def post(self, user_id):
		args = postParser.parse_args()
		content = args['content']

		profile = Profile.objects(user=user_id).first()
		team = profile.LOLTeam

		if team is None:
			raise InvalidUsage('No team')

		if team.captain != profile:
			raise InvalidUsage('Unauthorized',401)

		post = TeamPost(user_profile=profile, team=team)
		post.save()

		return {'status' : 'success'}
Example #33
0
	def post(self, user_id):
		profile = Profile.objects(user=user_id).first()
		team = profile.LOLTeam
		if team is None:
			raise InvalidUsage('Team not found',404)
		if team.captain != profile:
			raise InvalidUsage('Unauthorized',401)
		if team.inGame is False:
			raise InvalidUsage('Not in a tournament')

		args = matchParser.parse_args()
		matchID = args['matchID']
		win = args['win']

		match = MatchHistory.objects(id=matchID).first()
		if team == match.teams[0]:
			index = 0
		else:
			index = 1
		if win is True:
			match.scores[index] += 0.5
		else:
			match.scores[index^1] += 0.5

		round = match.round
		if match.scores[0] > 0.5*round.bestOfN or match.scores[1] > 0.5*round.bestOfN:
			if int(match.scores[0]) != match.scores[0]:
				return {'status' : 'Dispute needs screen shots verifying'}
			if match.scores[0] > match.scores[1]:
				win_team = match.teams[0]
				lose_team = match.teams[1]
			else:
				win_team = match.teams[1]
				lose_team = match.teams[0]

			lose_team.inGame = False
			lose_team.save()
			round = round.next
			if round is None:
				win_team.inGame = False
				win_team.save()
				return {'status' : 'Tournament Ended'}
			update(win_team,round)

		return {'status' : 'success', 'message' : 'Please get tournament code for the next game'}
Example #34
0
	def delete(self, user_id):
		profile = Profile.objects(user=user_id).first()
		if profile.LOLTeam is None:
			raise InvalidUsage('Not joined any team yet')

		team = profile.LOLTeam
		if team.captain == profile:
			raise InvalidUsage('Captain is not allowed to quit')
	
		team.update(pull__members=profile)

		profile.LOLTeam = None
		profile.save()
		team.save()

		rongcloudLeaveGroup(profile.id,team.id)

		return {'status' : 'success'}
Example #35
0
	def delete(self, user_id):
		profile = Profile.objects(user=user_id).first()
		if profile.LOLTeam is None:
			raise InvalidUsage('Not joined any team yet')
		team = profile.LOLTeam
		if team.captain != profile:
			raise InvalidUsage('Unauthorized',401)
		# update members' profiles
		for member in team.members:
			member.LOLTeam = None
			member.save()

		profile.LOLTeam = None
		profile.save()
		team.delete()

		rongcloudDismissGroup(profile.id,team.id)

		return {'status' : 'success'}
Example #36
0
	def post(self, user_id):
		args = teamParser.parse_args()
		profile = Profile.objects(user=user_id).first()
		if profile.LOLTeam is not None:
			raise InvalidUsage('Already joined a team')

		teamName = args['teamName']
		team = LOLTeam.objects(teamName=teamName).first()

		if team is None:
			raise InvalidUsage('Team not found',404)

		captain = team.captain
		request = Request.objects(user=captain.user,type='join').only('requests_list').first()
		if request is None:
			request = Request(user=captain.user,type='join')
			request.save()
		request.update(add_to_set__requests_list=profile)

		return {'status' : 'success'}
Example #37
0
def rongcloudToken(profile_id):
    # load profile 
    profile = Profile.objects(id=profile_id).first()
    if profile is None:
    	raise InvalidUsage("Wrong action",401)

    user = profile.user

    token = api.call_api(
    action="/user/getToken",
    params={
        "userId": profile_id,
        "name":profile.username,
        "portraitUri":profile.profile_icon
        }
    )

    user.rongToken = token['token']
    user.save()
    return token
Example #38
0
    def post(self):
        args = userParser.parse_args()
        email = args['email']
        password = args['password']
        if email is None or password is None:
            abort(400)
  
        user = User.objects(email=email).first()

        if not user or not user.verify_password(password):
            raise InvalidUsage('Email and password do not match')
        if not user.is_activated:
            raise InvalidUsage('Account not activated')

        profile = Profile.objects(user=user.id).first()

        rongToken = rongcloudToken(profile.id)
        token = user.generate_auth_token()
        redis_store.set(str(user.id), token)
        return {'token': token, 'rongToken' : rongToken}
Example #39
0
  def update(self):
    if self.request.method.upper() != "POST":
      return

    if self.profile == None:
      self.profile = Profile(user=self.user)
    self.profile.organization = self.params.get('organization')
    self.profile.section = self.params.get('section')
    self.profile.last_name = self.params.get('last_name')
    self.profile.first_name = self.params.get('first_name')
    self.profile.last_name_hira = self.params.get('last_name_hira')
    self.profile.first_name_hira = self.params.get('first_name_hira')
    self.profile.email = self.params.get('email')
    self.profile.tel_no = self.params.get('tel_no')
    self.profile.zip_code = self.params.get('zip_code')
    self.profile.prefecture = self.params.get('prefecture')
    self.profile.city = self.params.get('city')
    self.profile.address = self.params.get('address')

    self.profile.put()
Example #40
0
    def post(self):
        args = forgetPasswordParser.parse_args()
        email = args['email']
        username = args['username']
        school = args['school']

        if email is None or username is None or school is None:
            abort(400)

        user = User.objects(email=email).first()
        if user is None:
            raise InvalidUsage('User not found',404)

        profile = Profile.objects(user=user).first()
        if not profile.checkInfo(username, school):
            raise InvalidUsage('Information does not match',401)

        token = user.generate_auth_token(expiration=360000)
        send_forget_password_email(email, token)

        return {'status': 'success', 'message': 'An email has been sent to you letting you reset password'}
Example #41
0
    def post(self, user_id):
        uploaded_file = request.files['upload']
        filename = "_".join([user_id, uploaded_file.filename])

        conn = boto.connect_s3('AKIAJAQHGWIZDOAEQ65A', 'FpmnFv/jte9ral/iXHtL8cDUnuKXAgAqp9aXVQMI')
        bucket = conn.get_bucket('profile-icon')
        key = bucket.new_key(filename)
        key.set_contents_from_file(uploaded_file)

        profile = Profile.objects(user=user_id).first()
        if profile is None:
            profile = Profile(user=user_id, profile_icon='https://s3-us-west-2.amazonaws.com/profile-icon/%s' %filename)
            profile.save()
        else:
            profile.profile_icon = 'https://s3-us-west-2.amazonaws.com/profile-icon/%s' %filename
            profile.save()

        rongRefresh(profile.id)
        
        return serialize(profile)
Example #42
0
	def delete(self, user_id):
		args = tournamentParser.parse_args()
		tournamentID = args['tournamentID']
		if tournamentID is None:
			raise InvalidUsage('Provide tournament id please')

		profile = Profile.objects(user=user_id).first()

		tournament = Tournament.objects(id=tournamentID).first()
		if tournament is None:
			raise InvalidUsage('Tournament not found',404)
		if tournament.creator != profile:
			raise InvalidUsage('Unauthorized',401)
		# More deletions need to be added
		rule = Rule.objects(tournament=tournament).first()
		if rule is not None:
			rule.delete()
		for round in tournament.rounds:
			round.delete()

		tournament.delete()
		return {'status':'success'}
Example #43
0
    def __init__(self, docproxy, parent=None):
        super(ConvertDialog,
              self).__init__(_T("Convert to Profile"), parent,
                             gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                             (gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL,
                              gtk.RESPONSE_CANCEL))

        self._profiles = Profile.get_all()

        frame = gtk.Frame(_T("Source") + ':')
        self.vbox.pack_start(frame, False, False)

        hbox = gtk.HBox()
        frame.add(hbox)

        label = gtk.Label(_T("Profile") + ': %s' % docproxy.profile)
        label.set_justify(gtk.JUSTIFY_LEFT)
        hbox.pack_start(label, False, False)

        frame = gtk.Frame(_T("Destination") + ':')
        self.vbox.pack_start(frame, False, False)

        self._dest = cb = gtk.combo_box_new_text()
        for profile in self._profiles:
            cb.append_text(str(profile))
        cb.set_active(0)

        hbox = gtk.HBox()
        frame.add(hbox)

        hbox.pack_start(gtk.Label(_T("Profile") + ': '), False, False)
        hbox.pack_start(cb, False, False)

        frame = gtk.Frame(_T("Options") + ':')
        self.vbox.pack_start(frame, False, False)

        vbox = gtk.VBox()
        frame.add(vbox)

        cb = gtk.combo_box_new_text()
        cb.append_text(_T("Perceptual"))
        cb.append_text(_T("Relative Colorimetric"))
        cb.append_text(_T("Saturation"))
        cb.append_text(_T("Absolute Colorimetric"))
        cb.set_active(0)

        hbox = gtk.HBox()
        vbox.pack_start(hbox)

        hbox.pack_start(gtk.Label(_T("Intent") + ': '), False, False)
        hbox.pack_start(cb, False, False)

        bt1 = gtk.CheckButton(_T("Use Black Point Compensation") + ': ')
        bt2 = gtk.CheckButton(_T("Use Dither") + ': ')
        bt3 = gtk.CheckButton(_T("Flatten Image") + ': ')
        if len(docproxy.document.layers) == 1:
            bt3.set_sensitive(False)

        vbox.pack_start(bt1)
        vbox.pack_start(bt2)
        vbox.pack_start(bt3)

        self.show_all()
Example #44
0
 def renderPortfolio(self, portfolio_id):
     portfolio = Profile.find(portfolio_id)
     funds = Fund.list(portfolio_id)
     return portfolio, list(funds)
Example #45
0
 def addPortfolio(self, prof_name, org_id):
     prof = Profile.add(prof_name, org_id)
     return prof
 def novo(self, rs):
     return Profile(self.usuario, rs[0], rs[1], rs[2])
def test_add_empty_contact(app):
    old_profiles = app.profile.get_contact_list()
    app.profile.create_contact(Profile(firstname="", lastname="", nickname="", address="", mobile="", email="",
                                       bday="", bmonth="", byear="", address2=""))
    new_profiles = app.profile.get_contact_list()
    assert len(old_profiles) + 1 == len(new_profiles)
Example #48
0
 def renderProf(self, prof_id):
     prof = Profile.find(prof_id)
     funds = Fund.list(prof_id)
     return prof, list(funds)
def test_add_contact(app):
    old_profiles = app.profile.get_contact_list()
    app.profile.create_contact(Profile(firstname="Saimon", lastname="Ozhereliev", nickname="Sfai", address="Moscow", mobile="916 176-66-66", email="*****@*****.**",
                                       bday="18", bmonth="April", byear="1986", address2="Moscow city"))
    new_profiles = app.profile.get_contact_list()
    assert len(old_profiles) + 1 == len(new_profiles)
Example #50
0
 def addProf(self, prof_name, org_id):
     prof = Profile.add(prof_name, org_id)
     return prof
Example #51
0
from api import server
from authentication import Authentication
from model.character import Character
from model.profile import Profile

server.blueprint(Authentication.resource(url_prefix='v1'))

server.blueprint(Profile.resource(url_prefix='v1'))
server.blueprint(Character.resource(url_prefix='v1'))