Exemplo n.º 1
0
 def send_email(self, **kw):
     user = User.by_user_id(kw['user_id'])
     if user.recruiter:  # This line avoids us to pestarci i piedi a vicenda asd
         abort(403)
     recruiter = Recruiter.by_telegram(kw['recruiter'])
     user.recruiter_id = recruiter.id
     noreply_email = User.by_user_id(1).email_address
     mailer = get_mailer(request)
     message = Message(subject="Reclutamento WEEE Open",
                       sender=noreply_email,
                       recipients=[user.email_address],
                       body=kw['mail'])
     mailer.send(message)
     flash("Messaggio inviato")
     return redirect('/soviet')
Exemplo n.º 2
0
 def read(self, uid, **kw):
     if not uid:
         abort(404)
     user = User.by_user_id(uid)
     if not user:
         abort(404)
     return dict(page='soviet-read', user=user)
Exemplo n.º 3
0
 def accept(self, uid, **kw):
     if not uid:
         abort(404)
     user = User.by_user_id(uid)
     if not user:
         abort(404)
     user.status = True
     return redirect('/soviet')
Exemplo n.º 4
0
 def delete(self, uid, **kw):
     if not uid:
         abort(404)
     user = User.by_user_id(uid)
     if not user:
         abort(404)
     DBSession.delete(user)
     return redirect('/soviet')
Exemplo n.º 5
0
 def clear(self, uid, **kw):
     if not uid:
         abort(404)
     user = User.by_user_id(uid)
     if not user:
         abort(404)
     user.status = None
     return redirect('/soviet')
Exemplo n.º 6
0
    def contact(self, uid):
        if not uid:
            abort(404)
        user = User.by_user_id(uid)
        if not user:
            abort(404)

        recruiters = DBSession.query(Recruiter).all()

        return dict(page='soviet-contact', user=user, recruiters=recruiters)
Exemplo n.º 7
0
 def delete(self, m, auth, **kw):
     if not m or not auth:
         abort(404)
     user = User.by_user_name(m)
     if user:
         if user.token == auth:
             DBSession.delete(user)
             flash(_('Tutti i tuoi dati sono stati cancellati!'))
             return redirect('/')
     abort(404)
Exemplo n.º 8
0
 def status(self, m, auth, **kw):
     if not m or not auth:
         abort(404)
     user = User.by_user_name(m)
     if user:
         if user.token == auth:
             deletion_link = url(
                 "/form/delete?m=") + user.user_name + "&auth=" + user.token
             gdpr_link = url("/form/gdpr_data?m="
                             ) + user.user_name + "&auth=" + user.token
             return dict(page='form-status',
                         user=user,
                         deletion_link=deletion_link,
                         gdpr_link=gdpr_link)
     abort(404)
Exemplo n.º 9
0
 def gdpr_data(self, m, auth, **kw):
     if not m or not auth:
         abort(404)
     user = User.by_user_name(m)
     if user:
         if user.token == auth:
             response.headerlist.append(
                 ('Content-Disposition',
                  str('attachment;filename=%s-gdpr-data.json' %
                      user.user_name)))
             user_dict = dict(id=user.user_id,
                              username=user.user_name,
                              auth_token=user.token,
                              email=user.email_address,
                              first_name=user.first_name,
                              last_name=user.last_name,
                              study_course=user.study_course,
                              study_year=user.year,
                              interest=user.interest,
                              motivation_letter=user.letter)
             return dumps(user_dict, indent=2)
     abort(404)
Exemplo n.º 10
0
 def save_notes(self, **kw):
     user = User.by_user_id(kw['uid'])
     user.notes = kw['notes']
     return redirect('/soviet/read', params=dict(uid=kw['uid']))
Exemplo n.º 11
0
    def save(self, **kw):
        if not is_valid_sn(kw['user_name']):
            flash(
                _('Caro utonto, inserisci il tuo numero di matricola nel formato indicato.'
                  ), 'error')
            return redirect('/form/edit')
        user = User.by_user_name(kw['user_name'])
        if user:
            flash(_('Matricola già in uso!'), 'error')
            return redirect('/form/edit')

        token = generate_password()
        passwd = generate_password()

        user = User()
        user.user_name = kw['user_name'].lower()
        user.email_address = user.user_name + \
                             ('@studenti.polito.it' if user.user_name[0] == 's' else '@polito.it')
        user.display_name = user.user_name
        user.first_name = kw['first_name']
        user.last_name = kw['last_name']
        user.study_course = kw['cdl']
        user.year = kw['year']
        user.interest = kw['interest']
        user.letter = kw['letter']
        user.compiled = datetime.now()
        user.token = token
        user.password = passwd
        user.created = datetime.now()
        DBSession.add(user)
        DBSession.flush()

        status_link = url('/form/status?m=', None, True) + user.user_name
        status_link += '&auth=' + token

        noreply_email = User.by_user_id(1).email_address
        mailer = get_mailer(request)
        message = Message(subject="Reclutamento WEEE Open",
                          sender=noreply_email,
                          recipients=[user.email_address],
                          body=("""Ciao!

Abbiamo ricevuto la tua candidatura per il team WEEE Open, questa è la pagina da cui potrai verificare lo stato della tua domanda:

%s

Se la domanda sarà approvata, riceverai un'email sempre a questo indirizzo con scritto chi contattare per passare al colloquio. Le stesse informazioni saranno visibili anche alla pagina di cui sopra.

Buona fortuna ;)
Il software WEEEHire per conto del team WEEE Open
""" % status_link))
        mailer.send(message)
        flash(
            _(f"Candidatura inviata con successo!\nSalva questa pagina nei preferiti per controllare lo stato. Ti abbiamo inviato lo stesso link anche a {user.email_address}"
              ))
        return redirect(status_link)