Commit d1d80495 authored by Nick Poulden's avatar Nick Poulden
Browse files

Auth cookie expiration fix and comment error message box

parent f4ea72fa
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -175,10 +175,23 @@ Ext.define('Docs.controller.Auth', {
        return Boolean(this.sid);
    },

    /**
     * Sets the session ID.
     * @param {String} sid  The session ID
     * @param {Object} opts (optional)
     * @param {Boolean} opts.remember  'Remember me' flag is set
     */
    setSid: function(sid, opts) {

        this.sid = sid;
        if (sid && opts && opts.remember) {
            Ext.util.Cookies.set('sid', sid);

        if (sid) {
            var expires = null;
            if (opts && opts.remember) {
                expires = new Date();
                expires.setTime(expires.getTime() + (60 * 60 * 24 * 30 * 1000)); // 30 days
            }
            Ext.util.Cookies.set('sid', sid, expires);
        } else {
            Ext.util.Cookies.clear('sid');
        }
+4 −2
Original line number Diff line number Diff line
@@ -198,10 +198,10 @@ Ext.define('Docs.controller.Comments', {
                    postButton.removeCls('disabled');
                    this.toggleNewComment(null, el);
                    this.lastCommentPost = Math.ceil(Number(new Date()) / 1000);
                    if (data.action == 'comment') {
                    if (data.success && data.id) {
                        this.fetchComments(id, this.appendNewComment, {id: data.id});
                    } else {
                        Ext.Msg.alert('Thank you', 'Thank you for your feedback.');
                        Ext.Msg.alert('Error', data.reason || "There was an error submitting your request");
                    }
                }
            },
@@ -272,6 +272,8 @@ Ext.define('Docs.controller.Comments', {
                        this.fireEvent('remove', cls);
                    }
                    Ext.get(id).remove();
                } else {
                    Ext.Msg.alert('Error', data.reason || "There was an error submitting your request");
                }
            },
            scope: this